add cli describer for oauthtokens#9032
Conversation
pkg/cmd/cli/describe/describer.go
Outdated
| formatMeta(out, oAuthAccessToken.ObjectMeta) | ||
| formatString(out, "Client Name", oAuthAccessToken.ClientName) | ||
| formatString(out, "Expires In", oAuthAccessToken.ExpiresIn) | ||
| formatString(out, "Redirect URI", oAuthAccessToken.RedirectURI) |
There was a problem hiding this comment.
i don't think this value is very useful. The redirect already happened and someone doing a post-mortem on a token will have the json.
|
Looks good, the output just needs a little swizzling. |
9bc0497 to
d15b954
Compare
|
Updated output:
|
|
expires in should either be an absolute date, or relative to the current time |
Do you happen to know the answer to my question; #9032 (comment) ? |
|
@juanvallejo found it . |
|
Updated expiration time to absolute date (helper functions that we have fail to correctly handle a time difference longer than 24h so not using FormatRelativeTime for now, I will submit another pull request addressing this). Updated console output:
|
|
@deads2k
|
pkg/cmd/cli/describe/describer.go
Outdated
| formatString(out, "Expires In", formatToHumanDuration(timeExpired.Sub(time.Now()))) | ||
| formatString(out, "User Name", oAuthAccessToken.UserName) | ||
| formatString(out, "User UID", oAuthAccessToken.UserUID) | ||
| formatString(out, "Refresh Token", oAuthAccessToken.RefreshToken) |
There was a problem hiding this comment.
We don't provide these yet. Remove this line.
|
Can you show me an example 6 months in the future? |
pkg/cmd/cli/describe/helpers.go
Outdated
| return time.Now() | ||
| } | ||
|
|
||
| func TimeNowFn() time.Time { |
There was a problem hiding this comment.
Why are you exposing this?
|
@deads2k Output on token with expiration date 6months in the future:
|
Ok, go ahead and squash down |
test/fixtures/oauthaccesstoken.yaml
Outdated
| creationTimestamp: 2016-05-27T15:06:11Z | ||
| deletionTimestamp: 2016-11-28T15:06:11Z | ||
| name: DYGZDLucARCPIfUeKPhsgPfn0WBLR_9KdeREH0c9iod | ||
| resourceVersion: "5338" |
There was a problem hiding this comment.
remove creation,deleteion,resourceversion,selflink,uid
0d3243d to
a353593
Compare
|
@deads2k Okay, revised |
|
lgtm [merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/4176/) (Image: devenv-rhel7_4293) |
|
Evaluated for origin merge up to a353593 |
|
[Test]ing while waiting on the merge queue |
|
Evaluated for origin test up to a353593 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/4167/) |
Adds a command line describer for OAuth tokens:
oc describe oauthaccesstoken <token-name>fixes #9012