-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update identity to v2.0.0-beta.2
beta.2 uses pointers for empty struct fields, enabling a smaller output when marshaling to JSON. The New*Identity functions need to be updated to use the pointers correctly, and example output needs to be updated to demonstrate the smaller JSON output.
- Loading branch information
Showing
6 changed files
with
18 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,12 +44,12 @@ FLAGS | |
|
||
``` | ||
$ xrhidgen user -email [email protected] | ||
{"identity":{"org_id":"45841","internal":{"org_id":"45841"},"user":{"username":"backbencher","email":"[email protected]","first_name":"Cira","last_name":"Roob","is_active":false,"is_org_admin":true,"is_internal":false,"locale":"li","user_id":"nicole"},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"","username":""},"type":"User","auth_type":"cert-auth"},"entitlements":null} | ||
{"identity":{"account_number":"71384","org_id":"72467","internal":{"org_id":"72467"},"user":{"username":"rockabilly","email":"[email protected]","first_name":"Sawyer","last_name":"Ferry","is_active":true,"is_org_admin":true,"is_internal":false,"locale":"ee","user_id":"insurgence"},"type":"User","auth_type":"cert-auth"},"entitlements":null} | ||
``` | ||
|
||
``` | ||
$ xrhidgen system | base64 -w0 | ||
eyJpZGVudGl0eSI6eyJvcmdfaWQiOiIyMTcwMyIsImludGVybmFsIjp7Im9yZ19pZCI6IjIxNzAzIn0sInVzZXIiOnsidXNlcm5hbWUiOiIiLCJlbWFpbCI6IiIsImZpcnN0X25hbWUiOiIiLCJsYXN0X25hbWUiOiIiLCJpc19hY3RpdmUiOmZhbHNlLCJpc19vcmdfYWRtaW4iOmZhbHNlLCJpc19pbnRlcm5hbCI6ZmFsc2UsImxvY2FsZSI6IiIsInVzZXJfaWQiOiIifSwic3lzdGVtIjp7ImNuIjoiRyIsImNlcnRfdHlwZSI6ImNvbnN1bWVyIiwiY2x1c3Rlcl9pZCI6IkhKbyJ9LCJhc3NvY2lhdGUiOnsiUm9sZSI6bnVsbCwiZW1haWwiOiIiLCJnaXZlbk5hbWUiOiIiLCJyaGF0VVVJRCI6IiIsInN1cm5hbWUiOiIifSwieDUwOSI6eyJzdWJqZWN0X2RuIjoiIiwiaXNzdWVyX2RuIjoiIn0sInNlcnZpY2VfYWNjb3VudCI6eyJjbGllbnRfaWQiOiIiLCJ1c2VybmFtZSI6IiJ9LCJ0eXBlIjoiU3lzdGVtIiwiYXV0aF90eXBlIjoiYmFzaWMtYXV0aCJ9LCJlbnRpdGxlbWVudHMiOm51bGx9Cg== | ||
eyJpZGVudGl0eSI6eyJvcmdfaWQiOiI2NjY1MSIsImludGVybmFsIjp7Im9yZ19pZCI6IjY2NjUxIn0sInN5c3RlbSI6eyJjbiI6ImFFcEdUZSIsImNlcnRfdHlwZSI6ImNvbnN1bWVyIiwiY2x1c3Rlcl9pZCI6ImlUNksifSwidHlwZSI6IlN5c3RlbSIsImF1dGhfdHlwZSI6ImNlcnQtYXV0aCJ9LCJlbnRpdGxlbWVudHMiOm51bGx9Cg== | ||
``` | ||
|
||
``` | ||
|
@@ -61,7 +61,7 @@ used to initialize the generator to a deterministic state. | |
|
||
``` | ||
$ SEED=100 xrhidgen user | ||
{"identity":{"employee_account_number":"02299","org_id":"41123","internal":{"org_id":"41123"},"user":{"username":"skeptic","email":"[email protected]","first_name":"Cameron","last_name":"Stehr","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"fi","user_id":"meredeth"},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"","username":""},"type":"User","auth_type":"basic-auth"},"entitlements":null} | ||
{"identity":{"employee_account_number":"02299","org_id":"41123","internal":{"org_id":"41123"},"user":{"username":"skeptic","email":"[email protected]","first_name":"Cameron","last_name":"Stehr","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"fi","user_id":"meredeth"},"type":"User","auth_type":"basic-auth"},"entitlements":null} | ||
``` | ||
|
||
## Go package | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ func ExampleAssociate() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"employee_account_number":"02299","org_id":"41123","internal":{"org_id":""},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"[email protected]","givenName":"Cameron","rhatUUID":"00e3c758-1d7d-4ecd-98a2-997157e2d05c","surname":"Swift"},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"","username":""},"type":"Associate","auth_type":"basic-auth"},"entitlements":null} | ||
//Output: {"identity":{"employee_account_number":"02299","org_id":"41123","internal":{"org_id":""},"associate":{"Role":null,"email":"[email protected]","givenName":"Cameron","rhatUUID":"00e3c758-1d7d-4ecd-98a2-997157e2d05c","surname":"Swift"},"type":"Associate","auth_type":"basic-auth"},"entitlements":null} | ||
} | ||
|
||
func ExampleInternal() { | ||
|
@@ -32,7 +32,7 @@ func ExampleInternal() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"org_id":"03797","internal":{"org_id":"08321","auth_time":-2978345600000000000},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"","username":""},"type":"Internal","auth_type":"basic-auth"},"entitlements":null} | ||
//Output: {"identity":{"org_id":"03797","internal":{"org_id":"08321","auth_time":-2978345600000000000},"type":"Internal","auth_type":"basic-auth"},"entitlements":null} | ||
} | ||
|
||
func ExampleSystem() { | ||
|
@@ -46,7 +46,7 @@ func ExampleSystem() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"account_number":"16398","org_id":"57572","internal":{"org_id":"57572"},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{"cn":"It6P","cert_type":"consumer","cluster_id":"x8LdjPo"},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"","username":""},"type":"System","auth_type":"basic-auth"},"entitlements":null} | ||
//Output: {"identity":{"account_number":"16398","org_id":"57572","internal":{"org_id":"57572"},"system":{"cn":"It6P","cert_type":"consumer","cluster_id":"x8LdjPo"},"type":"System","auth_type":"basic-auth"},"entitlements":null} | ||
} | ||
|
||
func ExampleUser() { | ||
|
@@ -60,7 +60,7 @@ func ExampleUser() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":"23807"},"user":{"username":"tycoon","email":"[email protected]","first_name":"Frankie","last_name":"Collins","is_active":false,"is_org_admin":false,"is_internal":true,"locale":"pi","user_id":"backset"},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"","username":""},"type":"User","auth_type":"cert-auth"},"entitlements":null} | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":"23807"},"user":{"username":"tycoon","email":"[email protected]","first_name":"Frankie","last_name":"Collins","is_active":false,"is_org_admin":false,"is_internal":true,"locale":"pi","user_id":"backset"},"type":"User","auth_type":"cert-auth"},"entitlements":null} | ||
} | ||
|
||
func ExampleX509() { | ||
|
@@ -74,7 +74,7 @@ func ExampleX509() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":""},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"2","issuer_dn":"3sfSj"},"service_account":{"client_id":"","username":""},"type":"X509","auth_type":"cert-auth"},"entitlements":null} | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":""},"x509":{"subject_dn":"2","issuer_dn":"3sfSj"},"type":"X509","auth_type":"cert-auth"},"entitlements":null} | ||
} | ||
|
||
func ExampleServiceAccount() { | ||
|
@@ -88,5 +88,5 @@ func ExampleServiceAccount() { | |
panic(err) | ||
} | ||
fmt.Println(string(data)) | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":""},"user":{"username":"","email":"","first_name":"","last_name":"","is_active":false,"is_org_admin":false,"is_internal":false,"locale":"","user_id":""},"system":{},"associate":{"Role":null,"email":"","givenName":"","rhatUUID":"","surname":""},"x509":{"subject_dn":"","issuer_dn":""},"service_account":{"client_id":"2","username":"crump"},"type":"ServiceAccount","auth_type":"cert-auth"},"entitlements":null} | ||
//Output: {"identity":{"org_id":"23807","internal":{"org_id":""},"service_account":{"client_id":"2","username":"crump"},"type":"ServiceAccount","auth_type":"cert-auth"},"entitlements":null} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters