# 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).

require 'oci'
require 'date'

# 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::ConfigFileLoader.load_config

# Initialize service client with default config file
data_integration_client =
  OCI::DataIntegration::DataIntegrationClient.new(config: 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(
    'ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value',
    'EXAMPLE-taskKey-Value',
    OCI::DataIntegration::Models::CreateExternalPublicationDetails.new(
      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::DataIntegration::Models::ResourceConfiguration.new(
          spark_version: 'EXAMPLE-sparkVersion-Value',
          driver_shape: 'EXAMPLE-driverShape-Value',
          executor_shape: 'EXAMPLE-executorShape-Value',
          total_executors: 10
        ),
      configuration_details:
        OCI::DataIntegration::Models::ConfigurationDetails.new(
          data_asset:
            OCI::DataIntegration::Models::DataAssetFromHdfsDetails.new(
              model_type: 'HDFS_DATA_ASSET',
              host: 'EXAMPLE-host-Value',
              port: 'EXAMPLE-port-Value',
              protocol: 'EXAMPLE-protocol-Value',
              default_connection:
                OCI::DataIntegration::Models::ConnectionFromHdfsDetails.new(
                  model_type: 'HDFS_CONNECTION',
                  hdfs_principal: 'EXAMPLE-hdfsPrincipal-Value',
                  data_node_principal: 'EXAMPLE-dataNodePrincipal-Value',
                  name_node_principal: 'EXAMPLE-nameNodePrincipal-Value',
                  key: 'EXAMPLE-key-Value',
                  model_version: 'EXAMPLE-modelVersion-Value',
                  parent_ref:
                    OCI::DataIntegration::Models::ParentReference.new(
                      parent: 'EXAMPLE-parent-Value',
                      root_doc_id:
                        'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                    ),
                  name: 'EXAMPLE-name-Value',
                  description: 'EXAMPLE-description-Value',
                  object_version: 646,
                  object_status: 124,
                  identifier: 'EXAMPLE-identifier-Value',
                  primary_schema:
                    OCI::DataIntegration::Models::Schema.new(
                      key: 'EXAMPLE-key-Value',
                      model_type: 'EXAMPLE-modelType-Value',
                      model_version: 'EXAMPLE-modelVersion-Value',
                      parent_ref:
                        OCI::DataIntegration::Models::ParentReference.new(
                          parent: 'EXAMPLE-parent-Value',
                          root_doc_id:
                            'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                        ),
                      name: 'EXAMPLE-name-Value',
                      resource_name: 'EXAMPLE-resourceName-Value',
                      description: 'EXAMPLE-description-Value',
                      object_version: 534,
                      external_key: 'EXAMPLE-externalKey-Value',
                      is_has_containers: false,
                      default_connection: 'EXAMPLE-defaultConnection-Value',
                      object_status: 861,
                      identifier: 'EXAMPLE-identifier-Value',
                      metadata:
                        OCI::DataIntegration::Models::ObjectMetadata.new(
                          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.parse('2045-08-28T16:52:40.804Z'),
                          time_updated:
                            DateTime.parse('2030-01-30T04:06:32.377Z'),
                          aggregator_key: 'EXAMPLE-aggregatorKey-Value',
                          aggregator:
                            OCI::DataIntegration::Models::AggregatorSummary.new(
                              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_rhZKp' =>
                              'EXAMPLE_VALUE_1gBXVuR2YBgA7yNiWPq2'
                          },
                          registry_version: 560,
                          labels: %w[EXAMPLE--Value],
                          is_favorite: false,
                          count_statistics:
                            OCI::DataIntegration::Models::CountStatistic.new(
                              object_type_count_list: [
                                OCI::DataIntegration::Models::CountStatisticSummary
                                  .new(object_type: 'FOLDER', object_count: 15)
                              ]
                            )
                        )
                    ),
                  connection_properties: [
                    OCI::DataIntegration::Models::ConnectionProperty.new(
                      name: 'EXAMPLE-name-Value', value: 'EXAMPLE-value-Value'
                    )
                  ],
                  is_default: true,
                  metadata:
                    OCI::DataIntegration::Models::ObjectMetadata.new(
                      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.parse('2031-07-10T01:06:22.096Z'),
                      time_updated: DateTime.parse('2037-01-03T06:30:33.854Z'),
                      aggregator_key: 'EXAMPLE-aggregatorKey-Value',
                      aggregator:
                        OCI::DataIntegration::Models::AggregatorSummary.new(
                          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_MMpHU' =>
                          'EXAMPLE_VALUE_0ps8xTIulHa61vUsZAsk'
                      },
                      registry_version: 553,
                      labels: %w[EXAMPLE--Value],
                      is_favorite: true,
                      count_statistics:
                        OCI::DataIntegration::Models::CountStatistic.new(
                          object_type_count_list: [
                            OCI::DataIntegration::Models::CountStatisticSummary
                              .new(object_type: 'TASK', object_count: 549)
                          ]
                        )
                    ),
                  realm: 'EXAMPLE-realm-Value',
                  key_distribution_center:
                    'EXAMPLE-keyDistributionCenter-Value',
                  key_tab_content:
                    OCI::DataIntegration::Models::SensitiveAttribute.new(
                      secret_config:
                        OCI::DataIntegration::Models::OciVaultSecretConfig.new(
                          model_type: 'OCI_VAULT_SECRET_CONFIG',
                          secret_id:
                            'ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value'
                        ),
                      value: 'EXAMPLE-value-Value'
                    )
                ),
              key: 'EXAMPLE-key-Value',
              model_version: 'EXAMPLE-modelVersion-Value',
              name: 'EXAMPLE-name-Value',
              description: 'EXAMPLE-description-Value',
              object_status: 412,
              identifier: 'EXAMPLE-identifier-Value',
              external_key: 'EXAMPLE-externalKey-Value',
              asset_properties: {
                'EXAMPLE_KEY_T7KL8' => 'EXAMPLE_VALUE_Sj0CU5ZE4LuxuEWZos9T'
              },
              native_type_system:
                OCI::DataIntegration::Models::TypeSystem.new(
                  key: 'EXAMPLE-key-Value',
                  model_type: 'EXAMPLE-modelType-Value',
                  model_version: 'EXAMPLE-modelVersion-Value',
                  parent_ref:
                    OCI::DataIntegration::Models::ParentReference.new(
                      parent: 'EXAMPLE-parent-Value',
                      root_doc_id:
                        'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                    ),
                  name: 'EXAMPLE-name-Value',
                  description: 'EXAMPLE-description-Value',
                  object_version: 194,
                  type_mapping_to: {
                    'EXAMPLE_KEY_rcaL4' => 'EXAMPLE_VALUE_UfZB7yLP4bFX2XF9s2Cb'
                  },
                  type_mapping_from: {
                    'EXAMPLE_KEY_wAcWA' => 'EXAMPLE_VALUE_8iJIpMcaIhChzAVG8EzO'
                  },
                  object_status: 993,
                  identifier: 'EXAMPLE-identifier-Value',
                  types: [
                    OCI::DataIntegration::Models::DataType.new(
                      model_type: 'DATA_TYPE',
                      key: 'EXAMPLE-key-Value',
                      model_version: 'EXAMPLE-modelVersion-Value',
                      parent_ref:
                        OCI::DataIntegration::Models::ParentReference.new(
                          parent: 'EXAMPLE-parent-Value',
                          root_doc_id:
                            'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                        ),
                      name: 'EXAMPLE-name-Value',
                      object_status: 717,
                      description: 'EXAMPLE-description-Value',
                      dt_type: 'PRIMITIVE',
                      type_system_name: 'EXAMPLE-typeSystemName-Value',
                      config_definition:
                        OCI::DataIntegration::Models::ConfigDefinition.new(
                          key: 'EXAMPLE-key-Value',
                          model_type: 'EXAMPLE-modelType-Value',
                          model_version: 'EXAMPLE-modelVersion-Value',
                          parent_ref:
                            OCI::DataIntegration::Models::ParentReference.new(
                              parent: 'EXAMPLE-parent-Value',
                              root_doc_id:
                                'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                            ),
                          name: 'EXAMPLE-name-Value',
                          is_contained: false,
                          object_status: 106,
                          config_parameter_definitions: {
                            'EXAMPLE_KEY_t4MhJ' => {
                              'parameterType' => {
                                'modelType' => 'MATERIALIZED_COMPOSITE_TYPE',
                                'key' => 'EXAMPLE-key-Value',
                                'modelVersion' => 'EXAMPLE-modelVersion-Value',
                                'parentRef' => {
                                  'parent' => 'EXAMPLE-parent-Value',
                                  'rootDocId' =>
                                    'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                                },
                                'name' => 'EXAMPLE-name-Value',
                                'objectStatus' => 300,
                                'description' => 'EXAMPLE-description-Value',
                                'elements' => %w[EXAMPLE--Value],
                                'pathNames' => %w[EXAMPLE--Value]
                              },
                              'parameterName' => 'EXAMPLE-parameterName-Value',
                              'description' => 'EXAMPLE-description-Value',
                              'defaultValue' => 'EXAMPLE-defaultValue-Value',
                              'classFieldName' =>
                                'EXAMPLE-classFieldName-Value',
                              'isStatic' => True,
                              'isClassFieldValue' => False
                            }
                          }
                        )
                    )
                  ]
                ),
              object_version: 763,
              parent_ref:
                OCI::DataIntegration::Models::ParentReference.new(
                  parent: 'EXAMPLE-parent-Value',
                  root_doc_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                ),
              metadata:
                OCI::DataIntegration::Models::ObjectMetadata.new(
                  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.parse('2041-05-09T04:13:24.974Z'),
                  time_updated: DateTime.parse('2018-11-13T16:33:46.036Z'),
                  aggregator_key: 'EXAMPLE-aggregatorKey-Value',
                  aggregator:
                    OCI::DataIntegration::Models::AggregatorSummary.new(
                      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_PTviI' => 'EXAMPLE_VALUE_21ADI6PO7tu8M6sVgwHs'
                  },
                  registry_version: 280,
                  labels: %w[EXAMPLE--Value],
                  is_favorite: true,
                  count_statistics:
                    OCI::DataIntegration::Models::CountStatistic.new(
                      object_type_count_list: [
                        OCI::DataIntegration::Models::CountStatisticSummary.new(
                          object_type: 'FUNCTION_LIBRARY', object_count: 911
                        )
                      ]
                    )
                ),
              key_map: {
                'EXAMPLE_KEY_dd333' => 'EXAMPLE_VALUE_WsXJeuAN1fubT9RrCNDe'
              },
              validate_certificate: true
            ),
          connection:
            OCI::DataIntegration::Models::ConnectionFromObjectStorage.new(
              model_type: 'ORACLE_OBJECT_STORAGE_CONNECTION',
              key: 'EXAMPLE-key-Value',
              model_version: 'EXAMPLE-modelVersion-Value',
              parent_ref:
                OCI::DataIntegration::Models::ParentReference.new(
                  parent: 'EXAMPLE-parent-Value',
                  root_doc_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                ),
              name: 'EXAMPLE-name-Value',
              description: 'EXAMPLE-description-Value',
              object_version: 648,
              object_status: 130,
              identifier: 'EXAMPLE-identifier-Value',
              primary_schema:
                OCI::DataIntegration::Models::Schema.new(
                  key: 'EXAMPLE-key-Value',
                  model_type: 'EXAMPLE-modelType-Value',
                  model_version: 'EXAMPLE-modelVersion-Value',
                  parent_ref:
                    OCI::DataIntegration::Models::ParentReference.new(
                      parent: 'EXAMPLE-parent-Value',
                      root_doc_id:
                        'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                    ),
                  name: 'EXAMPLE-name-Value',
                  resource_name: 'EXAMPLE-resourceName-Value',
                  description: 'EXAMPLE-description-Value',
                  object_version: 975,
                  external_key: 'EXAMPLE-externalKey-Value',
                  is_has_containers: false,
                  default_connection: 'EXAMPLE-defaultConnection-Value',
                  object_status: 511,
                  identifier: 'EXAMPLE-identifier-Value',
                  metadata:
                    OCI::DataIntegration::Models::ObjectMetadata.new(
                      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.parse('2020-11-11T18:33:07.802Z'),
                      time_updated: DateTime.parse('2034-02-23T14:37:34.191Z'),
                      aggregator_key: 'EXAMPLE-aggregatorKey-Value',
                      aggregator:
                        OCI::DataIntegration::Models::AggregatorSummary.new(
                          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_JmezM' =>
                          'EXAMPLE_VALUE_efkZlfNe31yFcnZF8Y38'
                      },
                      registry_version: 58,
                      labels: %w[EXAMPLE--Value],
                      is_favorite: true,
                      count_statistics:
                        OCI::DataIntegration::Models::CountStatistic.new(
                          object_type_count_list: [
                            OCI::DataIntegration::Models::CountStatisticSummary
                              .new(object_type: 'CONNECTION', object_count: 907)
                          ]
                        )
                    )
                ),
              connection_properties: [
                OCI::DataIntegration::Models::ConnectionProperty.new(
                  name: 'EXAMPLE-name-Value', value: 'EXAMPLE-value-Value'
                )
              ],
              is_default: true,
              metadata:
                OCI::DataIntegration::Models::ObjectMetadata.new(
                  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.parse('2020-06-24T20:45:12.548Z'),
                  time_updated: DateTime.parse('2031-02-20T01:59:58.876Z'),
                  aggregator_key: 'EXAMPLE-aggregatorKey-Value',
                  aggregator:
                    OCI::DataIntegration::Models::AggregatorSummary.new(
                      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_DP3eC' => 'EXAMPLE_VALUE_xVGzCn1SSMGfxI35KRBL'
                  },
                  registry_version: 942,
                  labels: %w[EXAMPLE--Value],
                  is_favorite: false,
                  count_statistics:
                    OCI::DataIntegration::Models::CountStatistic.new(
                      object_type_count_list: [
                        OCI::DataIntegration::Models::CountStatisticSummary.new(
                          object_type: 'FUNCTION_LIBRARY', object_count: 488
                        )
                      ]
                    )
                ),
              key_map: {
                'EXAMPLE_KEY_jjQHN' => 'EXAMPLE_VALUE_CvBA4mfsKQ8PsjdPJpSD'
              },
              credential_file_content: 'EXAMPLE-credentialFileContent-Value',
              user_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value',
              finger_print: 'EXAMPLE-fingerPrint-Value',
              pass_phrase: 'EXAMPLE-passPhrase-Value'
            ),
          compartment_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
          schema:
            OCI::DataIntegration::Models::Schema.new(
              key: 'EXAMPLE-key-Value',
              model_type: 'EXAMPLE-modelType-Value',
              model_version: 'EXAMPLE-modelVersion-Value',
              parent_ref:
                OCI::DataIntegration::Models::ParentReference.new(
                  parent: 'EXAMPLE-parent-Value',
                  root_doc_id:
                    'ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value'
                ),
              name: 'EXAMPLE-name-Value',
              resource_name: 'EXAMPLE-resourceName-Value',
              description: 'EXAMPLE-description-Value',
              object_version: 574,
              external_key: 'EXAMPLE-externalKey-Value',
              is_has_containers: false,
              default_connection: 'EXAMPLE-defaultConnection-Value',
              object_status: 302,
              identifier: 'EXAMPLE-identifier-Value',
              metadata:
                OCI::DataIntegration::Models::ObjectMetadata.new(
                  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.parse('2034-02-13T04:26:00.045Z'),
                  time_updated: DateTime.parse('2014-05-14T01:19:44.924Z'),
                  aggregator_key: 'EXAMPLE-aggregatorKey-Value',
                  aggregator:
                    OCI::DataIntegration::Models::AggregatorSummary.new(
                      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_WhR9F' => 'EXAMPLE_VALUE_LBL4kIouMYkyLV77w02f'
                  },
                  registry_version: 585,
                  labels: %w[EXAMPLE--Value],
                  is_favorite: false,
                  count_statistics:
                    OCI::DataIntegration::Models::CountStatistic.new(
                      object_type_count_list: [
                        OCI::DataIntegration::Models::CountStatisticSummary.new(
                          object_type: 'DATA_ASSET', object_count: 679
                        )
                      ]
                    )
                )
            )
        )
    )
  )

# Get the data from response
puts "#{create_external_publication_response.data}"