# 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 'date'
require '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::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: 904
        ),
      configuration_details:
        OCI::DataIntegration::Models::ConfigurationDetails.new(
          data_asset:
            OCI::DataIntegration::Models::DataAssetFromAmazonS3.new(
              model_type: 'AMAZON_S3_DATA_ASSET',
              key: 'EXAMPLE-key-Value',
              model_version: 'EXAMPLE-modelVersion-Value',
              name: 'EXAMPLE-name-Value',
              description: 'EXAMPLE-description-Value',
              object_status: 150,
              identifier: 'EXAMPLE-identifier-Value',
              external_key: 'EXAMPLE-externalKey-Value',
              asset_properties: {
                'EXAMPLE_KEY_OcZhj' => 'EXAMPLE_VALUE_jLC6uqG2hZDa7cazVyfy'
              },
              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: 335,
                  type_mapping_to: {
                    'EXAMPLE_KEY_xpggS' => 'EXAMPLE_VALUE_pX9grLltN7HQhi532GMb'
                  },
                  type_mapping_from: {
                    'EXAMPLE_KEY_GEAIC' => 'EXAMPLE_VALUE_Np2LIRN0J5Qr2ZVnIu9y'
                  },
                  object_status: 3,
                  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: 698,
                      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: 967,
                          config_parameter_definitions: {
                            'EXAMPLE_KEY_1M7oQ' => {
                              'parameterType' => {
                                'modelType' => 'ARRAY_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' => 109,
                                'description' => 'EXAMPLE-description-Value',
                                'elementType' => 'EXAMPLE-elementType-Value'
                              },
                              'parameterName' => 'EXAMPLE-parameterName-Value',
                              'description' => 'EXAMPLE-description-Value',
                              'defaultValue' => 'EXAMPLE-defaultValue-Value',
                              'classFieldName' =>
                                'EXAMPLE-classFieldName-Value',
                              'isStatic' => True,
                              'isClassFieldValue' => True
                            }
                          }
                        )
                    )
                  ]
                ),
              object_version: 568,
              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('2037-09-17T10:04:44.973Z'),
                  time_updated: DateTime.parse('2017-10-26T12:53:11.831Z'),
                  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_iDmDo' => 'EXAMPLE_VALUE_AsMhZo1FHHgFJWCZxbLe'
                  },
                  registry_version: 742,
                  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: 193
                        )
                      ]
                    )
                ),
              key_map: {
                'EXAMPLE_KEY_BcMzo' => 'EXAMPLE_VALUE_LIuxZMmjcBwfEg3QXEpp'
              },
              region: 'EXAMPLE-region-Value',
              default_connection:
                OCI::DataIntegration::Models::ConnectionSummaryFromAmazonS3.new(
                  model_type: 'AMAZON_S3_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: 194,
                  object_status: 135,
                  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: 984,
                      external_key: 'EXAMPLE-externalKey-Value',
                      is_has_containers: true,
                      default_connection: 'EXAMPLE-defaultConnection-Value',
                      object_status: 855,
                      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('2048-03-28T21:01:19.272Z'),
                          time_updated:
                            DateTime.parse('2027-06-15T16:14:16.609Z'),
                          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_Mdb57' =>
                              'EXAMPLE_VALUE_Tg636IDIDbEqfA7ZaJvV'
                          },
                          registry_version: 645,
                          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_FLOW', object_count: 398
                                )
                              ]
                            )
                        )
                    ),
                  connection_properties: [
                    OCI::DataIntegration::Models::ConnectionProperty.new(
                      name: 'EXAMPLE-name-Value', value: 'EXAMPLE-value-Value'
                    )
                  ],
                  is_default: false,
                  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-12-27T12:27:08.334Z'),
                      time_updated: DateTime.parse('2030-10-18T01:01:31.861Z'),
                      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_rUUb1' =>
                          'EXAMPLE_VALUE_W3ANmKPgGviyxJ24qdae'
                      },
                      registry_version: 422,
                      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: 'FOLDER', object_count: 933)
                          ]
                        )
                    ),
                  key_map: {
                    'EXAMPLE_KEY_jUSYe' => 'EXAMPLE_VALUE_C4xX93YGvaNEjK3K4CGF'
                  },
                  access_key:
                    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'
                    ),
                  secret_key:
                    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'
                    )
                )
            ),
          connection:
            OCI::DataIntegration::Models::ConnectionFromOAuth2.new(
              model_type: 'OAUTH2_CONNECTION',
              access_token_url: 'EXAMPLE-accessTokenUrl-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: 357,
              object_status: 725,
              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: 679,
                  external_key: 'EXAMPLE-externalKey-Value',
                  is_has_containers: true,
                  default_connection: 'EXAMPLE-defaultConnection-Value',
                  object_status: 252,
                  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('2046-04-04T15:07:09.262Z'),
                      time_updated: DateTime.parse('2014-03-07T15:59:16.783Z'),
                      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_lPQyY' =>
                          'EXAMPLE_VALUE_QXILxPye4ITbuF8ijbQ1'
                      },
                      registry_version: 520,
                      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: 'APPLICATION', object_count: 960
                            )
                          ]
                        )
                    )
                ),
              connection_properties: [
                OCI::DataIntegration::Models::ConnectionProperty.new(
                  name: 'EXAMPLE-name-Value', value: 'EXAMPLE-value-Value'
                )
              ],
              is_default: false,
              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('2049-04-23T10:25:41.697Z'),
                  time_updated: DateTime.parse('2036-12-27T15:56:43.916Z'),
                  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_9eTgT' => 'EXAMPLE_VALUE_Oo6hBIOi4TnDR0UZ5xTz'
                  },
                  registry_version: 843,
                  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: 'PROJECT', object_count: 485
                        )
                      ]
                    )
                ),
              key_map: {
                'EXAMPLE_KEY_MC9ju' => 'EXAMPLE_VALUE_8zspyK6ZNIyENriBB5yL'
              },
              client_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value',
              client_secret:
                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'
                ),
              scope: 'EXAMPLE-scope-Value',
              grant_type: 'CLIENT_CREDENTIALS'
            ),
          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: 718,
              external_key: 'EXAMPLE-externalKey-Value',
              is_has_containers: false,
              default_connection: 'EXAMPLE-defaultConnection-Value',
              object_status: 227,
              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('2000-06-23T10:54:40.722Z'),
                  time_updated: DateTime.parse('2034-09-29T19:47:46.552Z'),
                  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_odEWd' => 'EXAMPLE_VALUE_mYMQ585T17LbNBgWoNJH'
                  },
                  registry_version: 724,
                  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: 'PROJECT', object_count: 631
                        )
                      ]
                    )
                )
            )
        )
    )
  )

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