Skip to content

Refactor MDM service to return a payload from check-ins#764

Merged
jessepeterson merged 3 commits intomicromdm:mainfrom
jessepeterson:checkout-payload
Jul 1, 2021
Merged

Refactor MDM service to return a payload from check-ins#764
jessepeterson merged 3 commits intomicromdm:mainfrom
jessepeterson:checkout-payload

Conversation

@jessepeterson
Copy link
Member

@jessepeterson jessepeterson commented Jun 18, 2021

Currently all of the Checkin messages don't return a response—they all succeed without any return value. However, certain Check-in messages require returning a payload such as UserAuthenticate, GetBootstrapToken, DeclarativeManagement, etc.

This PR adjusts the check-in interface to allow for returning payload data on a Check-in message which gets returned to the client verbatim (much like the Acknolwedge interface method already does). Note this PR does not implement any of the above; rather it just makes it possible for them to be implemented.

@jessepeterson jessepeterson mentioned this pull request Jun 18, 2021
@discentem
Copy link
Contributor

Hey Jesse,
Can you reword your description of what you are changing/implementing? I unfortunately don't understand what you mean by

This will allow the various check-in messages which return a payload to operate

)

func (svc *MDMService) Checkin(ctx context.Context, event CheckinEvent) error {
func (svc *MDMService) Checkin(ctx context.Context, event CheckinEvent) ([]byte, error) {
Copy link
Contributor

@discentem discentem Jun 25, 2021

Choose a reason for hiding this comment

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

Thoughts on adding a function comment to explain what the returned []byte represents and what it can be used for?

Copy link
Contributor

Choose a reason for hiding this comment

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

I realize there might be many functions which don't currently adhere to this standard of commenting but I think it would still be of value here.

https://dave.cheney.net/practical-go/presentations/qcon-china.html#_always_document_public_symbols

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I met you half-way. All of the implementors of the interface I add a small comment to. But I also added documentation to the main interface.

Copy link
Member Author

Choose a reason for hiding this comment

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

I walked this back, actually. In the document you posted:

There is one exception to this rule; you don’t need to document methods that implement an interface. Specifically don’t do this:

So I removed those. :)

@jessepeterson
Copy link
Member Author

Hey Jesse,
Can you reword your description of what you are changing/implementing? I unfortunately don't understand what you mean by

This will allow the various check-in messages which return a payload to operate

Done, hopefully more clear now.

Copy link
Contributor

@discentem discentem left a comment

Choose a reason for hiding this comment

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

LGTM

@discentem
Copy link
Contributor

Note, I haven't yet tested this commit myself.

@jessepeterson jessepeterson merged commit 4e684a4 into micromdm:main Jul 1, 2021
@jessepeterson jessepeterson deleted the checkout-payload branch October 13, 2023 22:19
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