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

Refactoring AccessToken Read method #341

Merged
merged 1 commit into from
Jun 28, 2024
Merged

Refactoring AccessToken Read method #341

merged 1 commit into from
Jun 28, 2024

Conversation

IaroslavTitov
Copy link
Contributor

Summary

  • tokenId property is not used anywhere at all, lol. The output tokenId is used as the resourceId, making this one useless
  • Eliminated use of req.GetProperties in AccessToken, which fixed import

Testing

  • pulumi import pulumiservice:index:AccessToken hui a7a15253-0108-4e39-89ff-3cd8859adba5

@IaroslavTitov IaroslavTitov requested a review from komalali June 28, 2024 19:45
@IaroslavTitov IaroslavTitov marked this pull request as ready for review June 28, 2024 19:45
Comment on lines -567 to -570
"tokenId": {
"description": "The token identifier.",
"type": "string"
},
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why we're removing this?

Copy link
Member

Choose a reason for hiding this comment

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

The output tokenId is used as the resourceId, making this one useless

I see this in the description, I'm not sure I understand the implication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned in description:

  • tokenId property is not used anywhere at all, lol. The output tokenId is used as the resourceId, making this one useless

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, as I mentioned in the thread, I don't really understand what that's supposed to mean. Why is it useless? What does it mean that it's not really used anywhere?

Copy link
Member

@komalali komalali Jun 28, 2024

Choose a reason for hiding this comment

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

I'll ask the question a different way - what do we (or our users) gain from making this breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, sorry, didn't update the page and never saw second comment ':D

So the property is literally not used. It's never filled out on create or update, never read from properties or anything. I think it was added originally, then author of AccessToken pivoted to storing tokenId in the resourceId and never cleaned up. That's just a guess as to why though.

We can leave it in to avoid breaking change, no problem with that really, except if a customer goes and tried to access the property and it's empty. Alternatively I can actually fill it out, but that would be storing the same data in 2 places.

So I think options are:

  • remove (my preference, breaking change, but not going to impact customers)
  • fill (redundant data storing)
  • ignore (do nothing, leave it as empty property)

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for explaining! Agree with you, makes sense to remove it.

inputMap := resource.PropertyMap{}
inputMap["description"] = resource.NewPropertyValue(input.Description)
outputStore := resource.PropertyMap{}
outputStore["__inputs"] = resource.NewObjectProperty(inputMap)
Copy link
Member

Choose a reason for hiding this comment

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

Should we stop doing this __inputs thing like we did for webhooks: #87

As described in the PR, we don't do this __inputs thing in ay other providers and have also been refactoring our code to move away from it in this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that, was trying to keep refactor just to the Read method fix

Copy link
Member

Choose a reason for hiding this comment

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

Totally cool to leave as-is for now, but let's open an issue to follow-up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #342

@IaroslavTitov IaroslavTitov merged commit 22339c0 into main Jun 28, 2024
13 checks passed
@IaroslavTitov IaroslavTitov deleted the iaro/accessToken branch June 28, 2024 21:31
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.

2 participants