Skip to content

Refactor and add BucketAccessor in preparation of framework migration for bucket resource#2240

Open
zliang-akamai wants to merge 2 commits intolinode:zhiwei/obj-region-validationfrom
zliang-akamai:zhiwei/refactor-for-bucket-migration
Open

Refactor and add BucketAccessor in preparation of framework migration for bucket resource#2240
zliang-akamai wants to merge 2 commits intolinode:zhiwei/obj-region-validationfrom
zliang-akamai:zhiwei/refactor-for-bucket-migration

Conversation

@zliang-akamai
Copy link
Member

@zliang-akamai zliang-akamai commented Jan 28, 2026

📝 Description

Add BucketAccessor for centralized object storage keys logic for the future Framework migration work for the bucket resource.

This branch is based on the feature branch of #2235, I will re-target the dev branch after #2235 being merged.

✔️ How to Test

make PKG_NAME="objbucket" test-int
make PKG_NAME="obj" test-int

@zliang-akamai zliang-akamai requested a review from a team as a code owner January 28, 2026 21:07
@zliang-akamai zliang-akamai requested review from Copilot, dawiddzhafarov and psnoch-akamai and removed request for a team January 28, 2026 21:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors object storage key resolution logic by introducing a BucketAccessor interface and centralizing the key retrieval logic in preparation for framework migration of the bucket resource. The changes improve code maintainability by extracting common patterns into reusable abstractions.

Changes:

  • Introduced BucketAccessor interface to standardize access to bucket-related properties across resources
  • Extracted object storage key resolution logic from ResourceModel into a standalone GetObjectStorageKeys function
  • Added helper methods to BaseModel and ResourceModel to implement the BucketAccessor interface

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
linode/objbucket/framework_models.go Added RegionOrCluster() and BucketLabel() methods to BaseModel to support BucketAccessor interface
linode/objbucket/framework_datasource_schema.go Reordered schema attributes to group id and label at the top, created at the bottom
linode/obj/helpers.go Updated call to use new standalone GetObjectStorageKeys function
linode/obj/framework_resource.go Renamed method call from GetRegionOrCluster to RegionOrCluster
linode/obj/framework_models.go Removed GetObjectStorageKeys method and added helper methods implementing BucketAccessor interface
linode/obj/bucket_accessor.go Created new file with BucketAccessor interface and GetObjectStorageKeys function for centralized key resolution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zliang-akamai zliang-akamai requested review from a team, mgwoj and vshanthe and removed request for a team January 30, 2026 03:39
@zliang-akamai zliang-akamai added the improvement for improvements in existing functionality in the changelog. label Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant