-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix: Refactored Go SDK to use Go oauth2 client, added x-looker-appid
header to Go requests
#1069
Conversation
Go Tests 6 files ±0 6 suites ±0 4m 10s ⏱️ -41s Results for commit 2ed10f0. ± Comparison against base commit 350d32d. This pull request removes 13 and adds 10 tests. Note that renamed tests count towards both.
|
x-looker-appid
header to Go SDK Requests, refactored to use Go oauth2 clientx-looker-appid
header to Go requests
Go Tests 6 files 6 suites 4m 42s ⏱️ Results for commit 38e0d5c. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice cleanup.
Go Tests 6 files 6 suites 5m 0s ⏱️ Results for commit 7a4dd9e. |
This comment has been minimized.
This comment has been minimized.
🤖 I have created a release \*beep\* \*boop\* --- <details><summary>sdk-codegen-all: 2.4.0</summary> ### Features * Add ExtensionProvider40 component ([#1068](https://www.github.com/looker-open-source/sdk-codegen/issues/1068)) ([425aee5](https://www.github.com/looker-open-source/sdk-codegen/commit/425aee5097361b580b3ff7e93f227d6d34f21eb3)) * generate SDK 22.6 ([#1102](https://www.github.com/looker-open-source/sdk-codegen/issues/1102)) ([2162860](https://www.github.com/looker-open-source/sdk-codegen/commit/2162860f0bf292bce0a79f8115f7c9fc5628057f)) ### Bug Fixes * add children property to ExtensionProvider type ([#1070](https://www.github.com/looker-open-source/sdk-codegen/issues/1070)) ([9524583](https://www.github.com/looker-open-source/sdk-codegen/commit/9524583fd99f0b46bba443a1dfa59cc6f42d081c)) * correct HTTP status code values ([#1101](https://www.github.com/looker-open-source/sdk-codegen/issues/1101)) ([3d0f902](https://www.github.com/looker-open-source/sdk-codegen/commit/3d0f902b67d6384c08641579ae959829c78d1994)) * description sync issues in diff scene ([#1086](https://www.github.com/looker-open-source/sdk-codegen/issues/1086)) ([a37aa50](https://www.github.com/looker-open-source/sdk-codegen/commit/a37aa50064bb41ca5af2c9d19371e2ef7973e6d9)) * example miner github permalinks do not use `.git` in the repository name ([#1063](https://www.github.com/looker-open-source/sdk-codegen/issues/1063)) ([e150b33](https://www.github.com/looker-open-source/sdk-codegen/commit/e150b33ff974575d731f48f2f1488bdbeeb9118c)) * package refs for API Explorer extension ([#1055](https://www.github.com/looker-open-source/sdk-codegen/issues/1055)) ([5fcf358](https://www.github.com/looker-open-source/sdk-codegen/commit/5fcf3588e1f4e87fc6d1d5789e00f66cf4fe92d9)) * Refactored Go SDK to use Go oauth2 client, added `x-looker-appid` header to Go requests ([#1069](https://www.github.com/looker-open-source/sdk-codegen/issues/1069)) ([d51a675](https://www.github.com/looker-open-source/sdk-codegen/commit/d51a6750f7d5f22efa84278492a71336e39d92e1)) * Register Go Fuzzy JSON Decoders once on init ([#1054](https://www.github.com/looker-open-source/sdk-codegen/issues/1054)) ([350d32d](https://www.github.com/looker-open-source/sdk-codegen/commit/350d32dfecb42679cff06e0c4508bebcf7fa6809)) * remove generated files from examples index ([#1076](https://www.github.com/looker-open-source/sdk-codegen/issues/1076)) ([d75bce8](https://www.github.com/looker-open-source/sdk-codegen/commit/d75bce8dc25d41fd6bc5e2e513782eaa6009fd10)) * replacing unimported exception ([#1066](https://www.github.com/looker-open-source/sdk-codegen/issues/1066)) ([d85b1b8](https://www.github.com/looker-open-source/sdk-codegen/commit/d85b1b889c9d27e337a5e8d38fc3f32e013cc4d8)) * Sidenav Methods Panel Open & Closing ([#1097](https://www.github.com/looker-open-source/sdk-codegen/issues/1097)) ([c49fae4](https://www.github.com/looker-open-source/sdk-codegen/commit/c49fae4ca6a7a30feb61f021ec878a8091eaa078)) * Update prod entrypoint to match dev entrypoint (pull [#1059](https://www.github.com/looker-open-source/sdk-codegen/issues/1059)) ([0e4c3f4](https://www.github.com/looker-open-source/sdk-codegen/commit/0e4c3f47782d23f6c8e5509bd2942b0934e44ea2)) </details> <details><summary>@looker/api-explorer: 0.9.33</summary> ### Bug Fixes * description sync issues in diff scene ([#1086](https://www.github.com/looker-open-source/sdk-codegen/issues/1086)) ([a37aa50](https://www.github.com/looker-open-source/sdk-codegen/commit/a37aa50064bb41ca5af2c9d19371e2ef7973e6d9)) * remove generated files from examples index ([#1076](https://www.github.com/looker-open-source/sdk-codegen/issues/1076)) ([d75bce8](https://www.github.com/looker-open-source/sdk-codegen/commit/d75bce8dc25d41fd6bc5e2e513782eaa6009fd10)) * Sidenav Methods Panel Open & Closing ([#1097](https://www.github.com/looker-open-source/sdk-codegen/issues/1097)) ([c49fae4](https://www.github.com/looker-open-source/sdk-codegen/commit/c49fae4ca6a7a30feb61f021ec878a8091eaa078)) * Update prod entrypoint to match dev entrypoint (pull [#1059](https://www.github.com/looker-open-source/sdk-codegen/issues/1059)) ([0e4c3f4](https://www.github.com/looker-open-source/sdk-codegen/commit/0e4c3f47782d23f6c8e5509bd2942b0934e44ea2)) ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/extension-utils bumped from ^0.1.9 to ^0.1.10 * @looker/code-editor bumped from ^0.1.21 to ^0.1.22 * @looker/run-it bumped from ^0.9.32 to ^0.9.33 * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-codegen bumped from ^21.5.2 to ^21.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 * devDependencies * @looker/sdk-codegen-scripts bumped from ^21.3.3 to ^21.3.4 * @looker/sdk-node bumped from ^22.4.2 to ^22.6.0 </details> <details><summary>@looker/extension-api-explorer: 22.6.0</summary> ### Bug Fixes * package refs for API Explorer extension ([#1055](https://www.github.com/looker-open-source/sdk-codegen/issues/1055)) ([5fcf358](https://www.github.com/looker-open-source/sdk-codegen/commit/5fcf3588e1f4e87fc6d1d5789e00f66cf4fe92d9)) ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/api-explorer bumped from ^0.9.32 to ^0.9.33 * @looker/extension-sdk bumped from ^22.4.2 to ^22.6.0 * @looker/extension-sdk-react bumped from ^22.4.2 to ^22.6.0 * @looker/extension-utils bumped from ^0.1.9 to ^0.1.10 * @looker/run-it bumped from ^0.9.32 to ^0.9.33 * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-codegen bumped from ^21.5.2 to ^21.6.0 </details> <details><summary>@looker/extension-sdk-react: 22.6.0</summary> ### Features * Add ExtensionProvider40 component ([#1068](https://www.github.com/looker-open-source/sdk-codegen/issues/1068)) ([425aee5](https://www.github.com/looker-open-source/sdk-codegen/commit/425aee5097361b580b3ff7e93f227d6d34f21eb3)) ### Bug Fixes * add children property to ExtensionProvider type ([#1070](https://www.github.com/looker-open-source/sdk-codegen/issues/1070)) ([9524583](https://www.github.com/looker-open-source/sdk-codegen/commit/9524583fd99f0b46bba443a1dfa59cc6f42d081c)) ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/extension-sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/sdk: 22.6.0</summary> ### Features * generate SDK 22.6 ([#1102](https://www.github.com/looker-open-source/sdk-codegen/issues/1102)) ([2162860](https://www.github.com/looker-open-source/sdk-codegen/commit/2162860f0bf292bce0a79f8115f7c9fc5628057f)) ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/sdk-codegen: 21.6.0</summary> ### Features * generate SDK 22.6 ([#1102](https://www.github.com/looker-open-source/sdk-codegen/issues/1102)) ([2162860](https://www.github.com/looker-open-source/sdk-codegen/commit/2162860f0bf292bce0a79f8115f7c9fc5628057f)) ### Bug Fixes * remove generated files from examples index ([#1076](https://www.github.com/looker-open-source/sdk-codegen/issues/1076)) ([d75bce8](https://www.github.com/looker-open-source/sdk-codegen/commit/d75bce8dc25d41fd6bc5e2e513782eaa6009fd10)) ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/sdk-codegen-scripts: 21.3.4</summary> ### Bug Fixes * example miner github permalinks do not use `.git` in the repository name ([#1063](https://www.github.com/looker-open-source/sdk-codegen/issues/1063)) ([e150b33](https://www.github.com/looker-open-source/sdk-codegen/commit/e150b33ff974575d731f48f2f1488bdbeeb9118c)) * remove generated files from examples index ([#1076](https://www.github.com/looker-open-source/sdk-codegen/issues/1076)) ([d75bce8](https://www.github.com/looker-open-source/sdk-codegen/commit/d75bce8dc25d41fd6bc5e2e513782eaa6009fd10)) ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-codegen bumped from ^21.5.2 to ^21.6.0 * @looker/sdk-node bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/sdk-rtl: 21.3.4</summary> ### Bug Fixes * correct HTTP status code values ([#1101](https://www.github.com/looker-open-source/sdk-codegen/issues/1101)) ([3d0f902](https://www.github.com/looker-open-source/sdk-codegen/commit/3d0f902b67d6384c08641579ae959829c78d1994)) </details> <details><summary>looker_sdk: 22.6.0</summary> ### Features * generate SDK 22.6 ([#1102](https://www.github.com/looker-open-source/sdk-codegen/issues/1102)) ([2162860](https://www.github.com/looker-open-source/sdk-codegen/commit/2162860f0bf292bce0a79f8115f7c9fc5628057f)) ### Documentation * Fixed link to issues ([#1079](https://www.github.com/looker-open-source/sdk-codegen/issues/1079)) ([7f22f7b](https://www.github.com/looker-open-source/sdk-codegen/commit/7f22f7b1958ac6df9a09a5bfc4a0356237be069f)), closes [#1077](https://www.github.com/looker-open-source/sdk-codegen/issues/1077) </details> <details><summary>@looker/extension-sdk: 22.6.0</summary> ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/sdk-node: 22.6.0</summary> ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/code-editor: 0.1.22</summary> ### Dependencies * The following workspace dependencies were updated * devDependencies * @looker/sdk-codegen bumped from ^21.5.2 to ^21.6.0 </details> <details><summary>@looker/wholly-sheet: 0.5.29</summary> ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 * devDependencies * @looker/sdk-node bumped from ^22.4.2 to ^22.6.0 </details> <details><summary>@looker/extension-utils: 0.1.10</summary> ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/extension-sdk bumped from ^22.4.2 to ^22.6.0 * @looker/extension-sdk-react bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> <details><summary>@looker/hackathon: 22.6.0</summary> ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/code-editor bumped from ^0.1.21 to ^0.1.22 * @looker/extension-sdk bumped from ^22.4.2 to ^22.6.0 * @looker/extension-sdk-react bumped from ^22.4.2 to ^22.6.0 * @looker/extension-utils bumped from ^0.1.9 to ^0.1.10 * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 * @looker/wholly-sheet bumped from ^0.5.28 to ^0.5.29 </details> <details><summary>@looker/run-it: 0.9.33</summary> ### Dependencies * The following workspace dependencies were updated * dependencies * @looker/code-editor bumped from ^0.1.21 to ^0.1.22 * @looker/extension-utils bumped from ^0.1.9 to ^0.1.10 * @looker/sdk bumped from ^22.4.2 to ^22.6.0 * @looker/sdk-codegen bumped from ^21.5.2 to ^21.6.0 * @looker/sdk-rtl bumped from ^21.3.3 to ^21.3.4 </details> This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: John Kaster <kaster@google.com>
Fixes #1027
Refactored to use Go's standard oauth2 client to handle our client credentials flow. The client will automatically fetch and refresh the token when it is expired. Removed all the manual authorization implementation.
Also updated the the AuthSession to maintain only one client instead of creating a new one per request. As recommended by Go docs.
Clients and Transports are safe for concurrent use by multiple goroutines and for efficiency should only be created once and re-used.
client docsAdded
x-looker-appid
header with standard go http middleware, the RoundTripper interface. Article because the docs are sparse on this one.Removed auth implementation specific tests. Added couple auth sanity tests even though the go client itself is well tested. Updated tests to properly call NewAuthSession to properly create the client.