# 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: 385
        ),
      configuration_details:
        OCI::DataIntegration::Models::ConfigurationDetails.new(
          data_asset:
            OCI::DataIntegration::Models::DataAssetFromLakeDetails.new(
              model_type: 'LAKE_DATA_ASSET',
              lake_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value',
              default_connection:
                OCI::DataIntegration::Models::ConnectionFromLakeDetails.new(
                  model_type: 'LAKE_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: 561,
                  object_status: 224,
                  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: 868,
                      external_key: 'EXAMPLE-externalKey-Value',
                      is_has_containers: false,
                      default_connection: 'EXAMPLE-defaultConnection-Value',
                      object_status: 270,
                      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-27T23:38:40.997Z'),
                          time_updated:
                            DateTime.parse('2012-03-24T12:38:31.066Z'),
                          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_2gLfR' =>
                              'EXAMPLE_VALUE_Ui5SvOe5DFkfNIG1lhPG'
                          },
                          registry_version: 708,
                          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: 888)
                              ]
                            )
                        )
                    ),
                  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-08-02T19:44:01.007Z'),
                      time_updated: DateTime.parse('2036-01-09T09:03:01.068Z'),
                      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_M8HX4' =>
                          'EXAMPLE_VALUE_JWEzOYn00twQJlj477Rh'
                      },
                      registry_version: 868,
                      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: 567
                            )
                          ]
                        )
                    )
                ),
              key: 'EXAMPLE-key-Value',
              model_version: 'EXAMPLE-modelVersion-Value',
              name: 'EXAMPLE-name-Value',
              description: 'EXAMPLE-description-Value',
              object_status: 399,
              identifier: 'EXAMPLE-identifier-Value',
              external_key: 'EXAMPLE-externalKey-Value',
              asset_properties: {
                'EXAMPLE_KEY_1ogaP' => 'EXAMPLE_VALUE_ClhRJcskNobq4ut85guE'
              },
              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: 780,
                  type_mapping_to: {
                    'EXAMPLE_KEY_JpsFo' => 'EXAMPLE_VALUE_j8o4h0PRKrup8Dm7CdYn'
                  },
                  type_mapping_from: {
                    'EXAMPLE_KEY_B8YlJ' => 'EXAMPLE_VALUE_eV0mqo9ksYMBO4Aqv1qr'
                  },
                  object_status: 944,
                  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: 534,
                      description: 'EXAMPLE-description-Value',
                      dt_type: 'STRUCTURED',
                      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: 397,
                          config_parameter_definitions: {
                            'EXAMPLE_KEY_QuhrE' => {
                              'parameterName' => 'EXAMPLE-parameterName-Value',
                              'description' => 'EXAMPLE-description-Value',
                              'defaultValue' => 'EXAMPLE-defaultValue-Value',
                              'classFieldName' =>
                                'EXAMPLE-classFieldName-Value',
                              'isStatic' => False,
                              'isClassFieldValue' => False
                            }
                          }
                        )
                    )
                  ]
                ),
              object_version: 816,
              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('2026-04-03T19:06:25.759Z'),
                  time_updated: DateTime.parse('2043-11-21T22:08:08.126Z'),
                  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_YJbnt' => 'EXAMPLE_VALUE_LbDo2avBQYJywkQsti2C'
                  },
                  registry_version: 515,
                  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: 'CONNECTION', object_count: 931
                        )
                      ]
                    )
                ),
              key_map: {
                'EXAMPLE_KEY_PpzLp' => 'EXAMPLE_VALUE_LbsRAWO6hzWZCebyBeV5'
              },
              metastore_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-Value',
              lake_proxy_endpoint: 'EXAMPLE-lakeProxyEndpoint-Value'
            ),
          connection:
            OCI::DataIntegration::Models::ConnectionFromAmazonS3.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: 587,
              object_status: 617,
              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: 134,
                  external_key: 'EXAMPLE-externalKey-Value',
                  is_has_containers: true,
                  default_connection: 'EXAMPLE-defaultConnection-Value',
                  object_status: 624,
                  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('2018-10-03T20:05:13.333Z'),
                      time_updated: DateTime.parse('2025-01-30T10:21:40.576Z'),
                      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_ZWr7l' =>
                          'EXAMPLE_VALUE_MKhiKVPd5soszfkk9ous'
                      },
                      registry_version: 690,
                      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: 658
                            )
                          ]
                        )
                    )
                ),
              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('2015-10-26T22:44:04.562Z'),
                  time_updated: DateTime.parse('2003-09-24T00:36:12.243Z'),
                  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_08u1f' => 'EXAMPLE_VALUE_f4GMD6jAkYyI1yRdL0nA'
                  },
                  registry_version: 501,
                  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: 19
                        )
                      ]
                    )
                ),
              key_map: {
                'EXAMPLE_KEY_7iCp2' => 'EXAMPLE_VALUE_NsPeCVBCoXUgSgHq7LWR'
              },
              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'
                )
            ),
          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: 545,
              external_key: 'EXAMPLE-externalKey-Value',
              is_has_containers: true,
              default_connection: 'EXAMPLE-defaultConnection-Value',
              object_status: 90,
              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('2031-08-21T01:54:14.736Z'),
                  time_updated: DateTime.parse('2024-12-01T09:15:49.516Z'),
                  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_DrKaW' => 'EXAMPLE_VALUE_crj6bvi9ICS5dlyj173Z'
                  },
                  registry_version: 491,
                  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: 774
                        )
                      ]
                    )
                )
            )
        )
    )
  )

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