Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move properties fetcher methods into Provider #4181

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Aug 16, 2024

Summary

This effectively enforces that providers must implement properties fetching as part of their implementation.

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@JAORMX JAORMX requested a review from a team as a code owner August 16, 2024 11:55
@JAORMX JAORMX marked this pull request as draft August 16, 2024 11:56
// FetchAllProperties implements the provider interface
// TODO: Implement this
func (_ *dockerHubImageLister) FetchAllProperties(_ context.Context, _ string, _ minderv1.Entity) (*properties.Properties, error) {
return nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

todo for me: Handle nil receiver on Properties (Property already does)

@@ -36,9 +36,6 @@ type REST struct {
credential provifv1.RestCredential
}

// Ensure that REST implements the REST interface
var _ provifv1.REST = (*REST)(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to remove these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so, REST and Git are not actually providers, but helper code that providers use to implement the relevant traits. I was thinking it would be good to start migrating away from these "trying" to implement the provider interface. This gets a little tricky, as we do treat them as providers in some test code, so I might just create a provider wrapper that uses these.

// FetchAllProperties fetches all properties for the given entity
FetchAllProperties(ctx context.Context, name string, entType minderv1.Entity) (*properties.Properties, error)
// FetchProperty fetches a single property for the given entity
FetchProperty(ctx context.Context, name string, entType minderv1.Entity, key string) (*properties.Property, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with moving these

@JAORMX JAORMX changed the title WIP: Move properties fetcher methods into Provider Move properties fetcher methods into Provider Aug 19, 2024
@JAORMX JAORMX marked this pull request as ready for review August 19, 2024 08:22
@coveralls
Copy link

Coverage Status

coverage: 53.894% (-0.05%) from 53.945%
when pulling d279d90 on fetcher-provider
into 3835934 on main.

@JAORMX JAORMX merged commit 02a42be into main Aug 19, 2024
23 checks passed
@JAORMX JAORMX deleted the fetcher-provider branch August 19, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants