Skip to content

Commit

Permalink
Make the doc example functions suspend for easier regex.
Browse files Browse the repository at this point in the history
  • Loading branch information
nand4011 committed Jan 16, 2024
1 parent 0526827 commit e9e60f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,12 @@ jobs:
java-version: 17
distribution: 'corretto'

- name: Set up gradle
uses: gradle/[email protected]
with:
build-root-directory: ./examples

- name: Run doc examples
uses: gradle/[email protected]
id: validation
run: ./gradlew docExamples readmeExample cheatSheetExample basic
with:
build-root-directory: ./examples
arguments: docExamples readmeExample cheatSheetExample basic

- name: Send CI failure mail
if: ${{ steps.validation.outcome == 'failure' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ const val FAKE_V1_API_KEY =
"ZEVCbGVHRnRjR3hsTG1OdmJTSjkuOEl5OHE4NExzci1EM1lDb19IUDRkLXhqSGRUOFVDSXV2QVljeGhGTXl6OCIsICJlbmRwb2ludCI6" +
"ICJ0ZXN0Lm1vbWVudG9ocS5jb20ifQo="

fun retrieveAuthTokenFromYourSecretsManager(): String {
suspend fun retrieveAuthTokenFromYourSecretsManager(): String {
return FAKE_V1_API_KEY
}

fun example_API_CredentialProviderFromEnvVar() {
suspend fun example_API_CredentialProviderFromEnvVar() {
CredentialProvider.fromEnvVar("MOMENTO_API_KEY")
}

fun example_API_CredentialProviderFromString() {
suspend fun example_API_CredentialProviderFromString() {
val authToken = retrieveAuthTokenFromYourSecretsManager()
CredentialProvider.fromString(authToken)
}

fun example_API_ConfigurationLaptop() {
suspend fun example_API_ConfigurationLaptop() {
Configurations.Laptop.latest
}

fun example_API_ConfigurationInRegionLatest() {
suspend fun example_API_ConfigurationInRegionLatest() {
Configurations.InRegion.latest
}

fun example_API_ConfigurationLowLatency() {
suspend fun example_API_ConfigurationLowLatency() {
Configurations.InRegion.LowLatency.latest
}

fun example_API_InstantiateCacheClient() {
suspend fun example_API_InstantiateCacheClient() {
CacheClient(
CredentialProvider.fromEnvVar("MOMENTO_API_KEY"), Configurations.Laptop.latest, 60.seconds
).use { cacheClient ->
Expand Down

0 comments on commit e9e60f2

Please sign in to comment.