Skip to content

Commit f0cc1db

Browse files
santoshkatagerisagarp337
authored andcommitted
Added - Support for LifecycleDetails in Data catalog Data assets resources
1 parent 52c704b commit f0cc1db

8 files changed

+21
-7
lines changed

internal/integrationtest/datacatalog_catalog_type_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func TestDatacatalogCatalogTypeResource_basic(t *testing.T) {
7272
resource.TestCheckResourceAttrSet(singularDatasourceName, "catalog_id"),
7373
resource.TestCheckResourceAttr(singularDatasourceName, "fields.#", "0"),
7474
resource.TestCheckResourceAttrSet(singularDatasourceName, "type_key"),
75-
resource.TestCheckResourceAttr(singularDatasourceName, "properties.%", "16"),
75+
resource.TestCheckResourceAttr(singularDatasourceName, "properties.%", "20"),
7676
resource.TestCheckResourceAttrSet(singularDatasourceName, "key"),
7777
),
7878
},

internal/integrationtest/datacatalog_metastore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var (
8989
}
9090
//Changes made for Create dependency resources
9191
DatacatalogMetastoreResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_objectstorage_bucket", "test_bucket", acctest.Required, acctest.Create, bucketRepresentationMetastore) +
92-
acctest.GenerateDataSourceFromRepresentationMap("oci_objectstorage_namespace", "test_namespace", acctest.Required, acctest.Create, ObjectStorageObjectStorageNamespaceSingularDataSourceRepresentation) +
92+
acctest.GenerateDataSourceFromRepresentationMap("oci_objectstorage_namespace", "test_namespace", acctest.Optional, acctest.Create, ObjectStorageObjectStorageNamespaceSingularDataSourceRepresentation) +
9393
acctest.GenerateResourceFromRepresentationMap("oci_objectstorage_object", "object1", acctest.Required, acctest.Create, objectRepresentationDefault) +
9494
acctest.GenerateResourceFromRepresentationMap("oci_objectstorage_object", "object2", acctest.Required, acctest.Create, objectRepresentationExternal) +
9595
DefinedTagsDependencies

internal/service/datacatalog/datacatalog_connection_resource.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ func (s *DatacatalogConnectionResourceCrud) SetData() error {
384384
catalogId, connectionKey, dataAssetKey, err := parseConnectionCompositeId(s.D.Id())
385385
if err == nil {
386386
s.D.Set("catalog_id", &catalogId)
387-
s.D.Set("connection_key", &connectionKey)
388387
s.D.Set("data_asset_key", &dataAssetKey)
389388
s.D.SetId(connectionKey)
390389
} else {

internal/service/datacatalog/datacatalog_data_asset_data_source.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func readSingularDatacatalogDataAsset(d *schema.ResourceData, m interface{}) err
3838
sync := &DatacatalogDataAssetDataSourceCrud{}
3939
sync.D = d
4040
sync.Client = m.(*client.OracleClients).DataCatalogClient()
41-
4241
return tfresource.ReadResource(sync)
4342
}
4443

@@ -91,6 +90,7 @@ func (s *DatacatalogDataAssetDataSourceCrud) Get() error {
9190
}
9291

9392
func (s *DatacatalogDataAssetDataSourceCrud) SetData() error {
93+
9494
if s.Res == nil {
9595
return nil
9696
}
@@ -117,6 +117,9 @@ func (s *DatacatalogDataAssetDataSourceCrud) SetData() error {
117117
s.D.Set("key", *s.Res.Key)
118118
}
119119

120+
if s.Res.LifecycleDetails != nil {
121+
s.D.Set("lifecycle_details", *s.Res.LifecycleDetails)
122+
}
120123
if s.Res.Properties != nil {
121124
s.D.Set("properties", propertiesToMap(s.Res.Properties))
122125
}

internal/service/datacatalog/datacatalog_data_asset_resource.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func DatacatalogDataAssetResource() *schema.Resource {
7474
Type: schema.TypeString,
7575
Computed: true,
7676
},
77+
"lifecycle_details": {
78+
Type: schema.TypeString,
79+
Computed: true,
80+
},
7781
"state": {
7882
Type: schema.TypeString,
7983
Computed: true,
@@ -214,10 +218,8 @@ func (s *DatacatalogDataAssetResourceCrud) Create() error {
214218

215219
func (s *DatacatalogDataAssetResourceCrud) Get() error {
216220
request := oci_datacatalog.GetDataAssetRequest{}
217-
218221
tmp := s.D.Id()
219222
request.DataAssetKey = &tmp
220-
221223
if catalogId, ok := s.D.GetOkExists("catalog_id"); ok {
222224
tmp := catalogId.(string)
223225
request.CatalogId = &tmp
@@ -319,7 +321,6 @@ func (s *DatacatalogDataAssetResourceCrud) SetData() error {
319321
catalogId, dataAssetKey, err := parseDataAssetCompositeId(s.D.Id())
320322
if err == nil {
321323
s.D.Set("catalog_id", &catalogId)
322-
s.D.Set("data_asset_key", &dataAssetKey)
323324
s.D.SetId(dataAssetKey)
324325
} else {
325326
log.Printf("[WARN] SetData() unable to parse current ID: %s", s.D.Id())
@@ -349,6 +350,10 @@ func (s *DatacatalogDataAssetResourceCrud) SetData() error {
349350
s.D.Set("key", *s.Res.Key)
350351
}
351352

353+
if s.Res.LifecycleDetails != nil {
354+
s.D.Set("lifecycle_details", *s.Res.LifecycleDetails)
355+
}
356+
352357
if s.Res.Properties != nil {
353358
s.D.Set("properties", propertiesToMap(s.Res.Properties))
354359
}
@@ -429,6 +434,10 @@ func DataAssetSummaryToMap(obj oci_datacatalog.DataAssetSummary) map[string]inte
429434
result["key"] = string(*obj.Key)
430435
}
431436

437+
if obj.LifecycleDetails != nil {
438+
result["lifecycle_details"] = string(*obj.LifecycleDetails)
439+
}
440+
432441
result["state"] = string(obj.LifecycleState)
433442

434443
if obj.TimeCreated != nil {

website/docs/d/datacatalog_data_asset.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The following attributes are exported:
4444
* `display_name` - A user-friendly display name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
4545
* `external_key` - External URI that can be used to reference the object. Format will differ based on the type of object.
4646
* `key` - Unique data asset key that is immutable.
47+
* `lifecycle_details` - A message describing the current state in more detail. An object not in ACTIVE state may have functional limitations, see service documentation for details.
4748
* `properties` - A map of maps that contains the properties which are specific to the asset type. Each data asset type definition defines it's set of required and optional properties. The map keys are category names and the values are maps of property name to property value. Every property is contained inside of a category. Most data assets have required properties within the "default" category. Example: `{"properties": { "default": { "host": "host1", "port": "1521", "database": "orcl"}}}`
4849
* `state` - The current state of the data asset.
4950
* `time_created` - The date and time the data asset was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: `2019-03-25T21:10:29.600Z`

website/docs/d/datacatalog_data_assets.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ The following attributes are exported:
6666
* `display_name` - A user-friendly display name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
6767
* `external_key` - External URI that can be used to reference the object. Format will differ based on the type of object.
6868
* `key` - Unique data asset key that is immutable.
69+
* `lifecycle_details` - A message describing the current state in more detail. An object not in ACTIVE state may have functional limitations, see service documentation for details.
6970
* `properties` - A map of maps that contains the properties which are specific to the asset type. Each data asset type definition defines it's set of required and optional properties. The map keys are category names and the values are maps of property name to property value. Every property is contained inside of a category. Most data assets have required properties within the "default" category. Example: `{"properties": { "default": { "host": "host1", "port": "1521", "database": "orcl"}}}`
7071
* `state` - The current state of the data asset.
7172
* `time_created` - The date and time the data asset was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: `2019-03-25T21:10:29.600Z`

website/docs/r/datacatalog_data_asset.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The following attributes are exported:
5151
* `display_name` - A user-friendly display name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
5252
* `external_key` - External URI that can be used to reference the object. Format will differ based on the type of object.
5353
* `key` - Unique data asset key that is immutable.
54+
* `lifecycle_details` - A message describing the current state in more detail. An object not in ACTIVE state may have functional limitations, see service documentation for details.
5455
* `properties` - A map of maps that contains the properties which are specific to the asset type. Each data asset type definition defines it's set of required and optional properties. The map keys are category names and the values are maps of property name to property value. Every property is contained inside of a category. Most data assets have required properties within the "default" category. Example: `{"properties": { "default": { "host": "host1", "port": "1521", "database": "orcl"}}}`
5556
* `state` - The current state of the data asset.
5657
* `time_created` - The date and time the data asset was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: `2019-03-25T21:10:29.600Z`

0 commit comments

Comments
 (0)