@@ -134,6 +134,11 @@ func init() {
134134 exportObjectStorageNamespaceHints .alwaysExportable = true
135135
136136 exportObjectStorageBucketHints .getIdFn = getObjectStorageBucketId
137+ exportObjectStorageObjectHints .getIdFn = getObjectStorageObjectId
138+ exportObjectStorageObjectHints .requireResourceRefresh = true
139+ exportObjectStorageObjectLifecyclePolicyHints .getIdFn = getObjectStorageObjectLifecyclePolicyId
140+ exportObjectStoragePreauthenticatedRequestHints .getIdFn = getObjectStorageObjectPreauthenticatedRequestId
141+ exportObjectStoragePreauthenticatedRequestHints .processDiscoveredResourcesFn = processObjectStoragePreauthenticatedRequest
137142
138143 exportStreamingStreamHints .processDiscoveredResourcesFn = processStreamingStream
139144
@@ -638,6 +643,93 @@ func getObjectStorageBucketId(resource *OCIResource) (string, error) {
638643 return getBucketCompositeId (name , namespace ), nil
639644}
640645
646+ func getObjectStorageObjectId (resource * OCIResource ) (string , error ) {
647+ name , ok := resource .sourceAttributes ["name" ].(string )
648+ if ! ok {
649+ return "" , fmt .Errorf ("[ERROR] unable to find name for object id" )
650+ }
651+
652+ bucket , ok := resource .parent .sourceAttributes ["name" ].(string )
653+ if ! ok {
654+ return "" , fmt .Errorf ("[ERROR] unable to find bucket for object id" )
655+ }
656+
657+ namespace , ok := resource .parent .sourceAttributes ["namespace" ].(string )
658+ if ! ok {
659+ return "" , fmt .Errorf ("[ERROR] unable to find namespace for object id" )
660+ }
661+
662+ return getObjectCompositeId (bucket , namespace , name ), nil
663+ }
664+
665+ func getObjectStorageObjectLifecyclePolicyId (resource * OCIResource ) (string , error ) {
666+ bucket , ok := resource .sourceAttributes ["bucket" ].(string )
667+ if ! ok {
668+ return "" , fmt .Errorf ("[ERROR] unable to find bucket for object Lifecycle Policy id" )
669+ }
670+
671+ namespace , ok := resource .sourceAttributes ["namespace" ].(string )
672+ if ! ok {
673+ return "" , fmt .Errorf ("[ERROR] unable to find namespace for object Lifecycle Policy id" )
674+ }
675+
676+ return getObjectLifecyclePolicyCompositeId (bucket , namespace ), nil
677+ }
678+
679+ func getObjectStorageObjectPreauthenticatedRequestId (resource * OCIResource ) (string , error ) {
680+ parId , ok := resource .sourceAttributes ["id" ].(string )
681+ if ! ok {
682+ return "" , fmt .Errorf ("[ERROR] unable to find parId for PreauthenticatedRequest id" )
683+ }
684+
685+ bucket , ok := resource .parent .sourceAttributes ["name" ].(string )
686+ if ! ok {
687+ return "" , fmt .Errorf ("[ERROR] unable to find bucket for PreauthenticatedRequest id" )
688+ }
689+
690+ namespace , ok := resource .parent .sourceAttributes ["namespace" ].(string )
691+ if ! ok {
692+ return "" , fmt .Errorf ("[ERROR] unable to find namespace for PreauthenticatedRequest id" )
693+ }
694+
695+ return getPreauthenticatedRequestCompositeId (bucket , namespace , parId ), nil
696+ }
697+
698+ func processObjectStoragePreauthenticatedRequest (clients * OracleClients , resources []* OCIResource ) ([]* OCIResource , error ) {
699+ for _ , index := range resources {
700+ index .sourceAttributes ["bucket" ] = index .parent .sourceAttributes ["name" ].(string )
701+ index .sourceAttributes ["namespace" ] = index .parent .sourceAttributes ["namespace" ].(string )
702+ }
703+ return resources , nil
704+ }
705+
706+ func getObjectStorageReplicationPolicyId (resource * OCIResource ) (string , error ) {
707+ replicationId , ok := resource .sourceAttributes ["id" ].(string )
708+ if ! ok {
709+ return "" , fmt .Errorf ("[ERROR] unable to find replicationId for replication id" )
710+ }
711+
712+ bucket , ok := resource .parent .sourceAttributes ["name" ].(string )
713+ if ! ok {
714+ return "" , fmt .Errorf ("[ERROR] unable to find bucket for replication id" )
715+ }
716+
717+ namespace , ok := resource .parent .sourceAttributes ["namespace" ].(string )
718+ if ! ok {
719+ return "" , fmt .Errorf ("[ERROR] unable to find namespace for replication id" )
720+ }
721+
722+ return getReplicationPolicyCompositeId (bucket , namespace , replicationId ), nil
723+ }
724+
725+ func processObjectStorageReplicationPolicy (clients * OracleClients , resources []* OCIResource ) ([]* OCIResource , error ) {
726+ for _ , index := range resources {
727+ index .sourceAttributes ["bucket" ] = index .parent .sourceAttributes ["name" ].(string )
728+ index .sourceAttributes ["namespace" ] = index .parent .sourceAttributes ["namespace" ].(string )
729+ }
730+ return resources , nil
731+ }
732+
641733func findIdentityTags (clients * OracleClients , tfMeta * TerraformResourceAssociation , parent * OCIResource ) ([]* OCIResource , error ) {
642734 // List on Tags does not return validator, and resource Read requires tagNamespaceId
643735 // which is also not returned in Summary response. Tags also do not have composite id in state.
0 commit comments