Skip to content
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

Retrieve TokenCredential from ConfigurableBootstrapContext for env post processor #41580

Merged
merged 8 commits into from
Aug 28, 2024

Conversation

saragluna
Copy link
Member

@saragluna saragluna commented Aug 21, 2024

Description

Fixes #38995.

With this change, you might need to modify your application as the following to register a TokenCredential bean to the ConfigurableBootstrapContext for the KeyVaultEnvironmentPostProcessor to use that token credential.

public static void main(String[] args) {
    SpringApplication application = new SpringApplication(PropertySourceApplication.class);
    application.addBootstrapRegistryInitializer(registry -> 
            registry.register(TokenCredential.class, context -> new AzureCliCredentialBuilder().build()));

    application.run(args);
}

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

Copy link
Member

@Netyyyy Netyyyy left a comment

Choose a reason for hiding this comment

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

LGTM

@saragluna
Copy link
Member Author

/azp run java - spring - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@saragluna
Copy link
Member Author

/check-enforcer override

@saragluna saragluna merged commit aa19dbf into Azure:main Aug 28, 2024
73 of 78 checks passed
@saragluna saragluna deleted the xiada/configure-kv-env-post-processor branch August 28, 2024 06:28
glharper pushed a commit that referenced this pull request Aug 28, 2024
…st processor (#41580)

* get TokenCredential from ConfigurableBootstrapContext

---------

Co-authored-by: Muyao <[email protected]>
Co-authored-by: Muyao Feng <[email protected]>
glharper added a commit that referenced this pull request Sep 18, 2024
* initial auto-genned code

* use camel case for Json in class name

* initial work on setting up a test

* Fix some compile errors

* test actually compiles (and fails)

* add to azure-sdks-all

* fix json typo causing defaultCompleteOptions to throw

* add completeStreaming convenience method and InferenceSSE class

* add chat samples (sync), streaming convenience fields

* simplify convenience method for defaultCompleteOptions

* got test working in intellij

* add streaming chat test

* add streaming chat async sample and support code to async client

* add convenience method for async complete, basic async chat sample

* change options class name

* merge deletes

* add async tests for complete and completeStreaming

* remove refs to jackson package

* add chat completions code to README (links needed)

* add troubleshooting file, links in README

* add readmeSamples class for readme code sample auto gen

* update genned code with embeddingsClient, imageEmbeddingsClient

* revert parameters to Object type

* add embedding sample

* add Embeddings test classes

* add async embeddings test

* add text embeddings async sample

* make embed method public

* cleaner embeddings sample output

* fix javadoc gen

* fix dep versions

* phrasing

* add AAD sample with scope

* better explanation of auth scope setting in sample

* allow mvn compile

* create and allow playback for test recordings

* change display name in ci.yml

* add codeowners

* kick off new build

* add tests.yml

* remove EnableBatchRelease field

* update to pass codegen test

* use existing label

* add ubinary to ignored words

* use proper streaming types, remove delta from ChatChoice

* rename getEmbedding to getEmbeddingList, add auto-genned method

* make getModelInfo public for java

* use Json instead of JSON in class/file name

* sync ChatChoice with TS output

* set partial-update to true

* codegen more closely synced

* use latest typespec

* add customization code

* updated typespec

* App Config Correlation Context update + yaml hint fix (#41607)

* Updating correlation context to use pipeline context

* Fixing yaml hints

* Updating property docs from yaml

* removing unused imports

* Use code customizations to map internal Storage error in generated code (#41624)

Use code customizations to map internal Storage error in generated code

* Add namespaces (packages) to packageInfo (#41639)

* Add namespaces (packages) to packageInfo

* Actually name the script correctly

* Fix incorrect parameter name

* correct fail the step if no namespaces can be determined for one of the libraries being processed

* Fix the pom file to remove the duplicate org.apache.maven.plugins:maven-jar-plugin definition

* turn off docs for spring-cloud-azure-appconfiguration-config-web until it actually generates docs

* Updates for feedback

* Fix dependency version issue

* Publish code coverage results from 1 to2 (#41656)

* Update PublishCodeCoverageResults task version from 1 to 2

* Add prerequisite task

* last commit missed a file needing a save

* Fix typo (#41658)

* prepare for 1.2.27 bom release (#41659)

* Move logging token acquisition to VERBOSE (#41648)

* Sync eng/common directory with azure-sdk-tools for PR 8875 (#41660)

* chore(): add playwright-testing to product slugs

* Update eng/common/scripts/Test-SampleMetadata.ps1

---------

Co-authored-by: Siddharth Singha Roy <[email protected]>
Co-authored-by: Wes Haggard <[email protected]>

* [App Configuration] Add test case for feature management lib (#41498)

* add feature management common test cases

* add test case for no filters

* initialize feature manager and call `featureManager.isEnabled()` to compare the result

* update the schema of test case

* get sample file and tests file by listFiles api

* update the todo comment.
Throw exception and use little endian are breaking change, will have both when update to 6.xx version.

* use `getContextClassLoader().getResource` to get the resource folder path

* address comment: typo wording error fix, add "@SuppressWarnings"

* address comment: typo wording error fix

* address comment: update member name

* add running log

* use contains to filter out the "TargetingFilter.sample.json"

* add some info log

* sort the file list

* move to another the package to avoid making feature manager construction as public

* address comment: use logging, remove else

* address comment: throw exception when empty "feature_management" section.

* address comment: rename symbol

* Update ValidationsTest.java

* fixing linting

* address comment: ignore both targeting filter test case

---------

Co-authored-by: Matt Metcalf <[email protected]>

* Retrieve TokenCredential from ConfigurableBootstrapContext for env post processor (#41580)

* get TokenCredential from ConfigurableBootstrapContext

---------

Co-authored-by: Muyao <[email protected]>
Co-authored-by: Muyao Feng <[email protected]>

* [Automation] Generate SDK based on TypeSpec 0.20.0 (#41666)

* [Automation] Generate SDK based on TypeSpec 0.20.0

* update assets.json

* revert healthinsights changes

---------

Co-authored-by: Haoling Dong <[email protected]>

* add customization to unfinalize base classes

* more typespec syncs

* correct doc comment

* make extra parameters public

* fix bad gen

* remove dupe imports

* sync with typespec

* add lint exception for PagedFlux

* lint fixes

* App Config Correlation Context update + yaml hint fix (#41607)

* Updating correlation context to use pipeline context

* Fixing yaml hints

* Updating property docs from yaml

* removing unused imports

* [OpenAI-Assistant] Added support for 2024-07-01 (#41464)

* Added support 2024-07-01 service API version (#41473)

* Default to sub config file paths/svc connection for public + sovereign live tests (#41267)

* remove azure.xml dependency

* make completeWithResponse public

* make complete with options public

* add string constructor for ChatRequestUserMessage

* add scopes to ClientBuilders, change parameters in FunctionDefinition to BinaryData type

* update comment

* correct string constructor for ChatRequestUserMessage

* formatting

* add streaming tool call sample

* add Mono<Response<>> completeWithResponse API to AsyncClient

* better implementation of completeWithResponse

* remove unused import

* add embedWithResponse API to embeddings clients

* add tests for complete(options) and completeWithResponse APIs

* more sync tests

* add stream response test

* add completeStreamWithResponse test, change completeStreaming to completeStream

* new test recordings

* changes for TypeSpec sync

* fix pom error

* add deleted file

* restore deleted files

* restore more deleted files

* even more deleted files

* pull in openai changes from main

* more deleted files

* unmod openai file

* update HTTP client link

* spacing for typespec gen

* update dependencies

* spacing

* spacing

* spacing

* update min jacoco settings

* trigger CI build

* Naive implementations of new APIs fromContentItems and file constructor for ChatMessageImageContentItem

* spacing

* add image read sample and correct API implementations

* sanity check, cleaner syntax, and samples style fixes

* Add ImageUrlChatSample

* update dependency version

* typespec sync

* review feedback

* Update sdk/ai/azure-ai-inference/README.md

Co-authored-by: Bill Wert <[email protected]>

* Update sdk/ai/azure-ai-inference/README.md

Co-authored-by: Bill Wert <[email protected]>

* fix TypeSpec crash

* remove unneeded paragraph

* make TypeSpec sync happy

* add access helper to ChatCompletionsOptions

* typespec sync

* review feedback

---------

Co-authored-by: Matthew Metcalf <[email protected]>
Co-authored-by: Alan Zimmer <[email protected]>
Co-authored-by: James Suplizio <[email protected]>
Co-authored-by: Shawn Fang <[email protected]>
Co-authored-by: Bill Wert <[email protected]>
Co-authored-by: Azure SDK Bot <[email protected]>
Co-authored-by: Siddharth Singha Roy <[email protected]>
Co-authored-by: Wes Haggard <[email protected]>
Co-authored-by: ivywei0125 <[email protected]>
Co-authored-by: Xiaolu Dai <[email protected]>
Co-authored-by: Muyao <[email protected]>
Co-authored-by: Muyao Feng <[email protected]>
Co-authored-by: Haoling Dong <[email protected]>
Co-authored-by: Ben Broderick Phillips <[email protected]>
jairmyree pushed a commit to jairmyree/azure-sdk-for-java that referenced this pull request Sep 23, 2024
…st processor (Azure#41580)

* get TokenCredential from ConfigurableBootstrapContext

---------

Co-authored-by: Muyao <[email protected]>
Co-authored-by: Muyao Feng <[email protected]>
mssfang added a commit to mssfang/azure-sdk-for-java that referenced this pull request Oct 21, 2024
* initial auto-genned code

* use camel case for Json in class name

* initial work on setting up a test

* Fix some compile errors

* test actually compiles (and fails)

* add to azure-sdks-all

* fix json typo causing defaultCompleteOptions to throw

* add completeStreaming convenience method and InferenceSSE class

* add chat samples (sync), streaming convenience fields

* simplify convenience method for defaultCompleteOptions

* got test working in intellij

* add streaming chat test

* add streaming chat async sample and support code to async client

* add convenience method for async complete, basic async chat sample

* change options class name

* merge deletes

* add async tests for complete and completeStreaming

* remove refs to jackson package

* add chat completions code to README (links needed)

* add troubleshooting file, links in README

* add readmeSamples class for readme code sample auto gen

* update genned code with embeddingsClient, imageEmbeddingsClient

* revert parameters to Object type

* add embedding sample

* add Embeddings test classes

* add async embeddings test

* add text embeddings async sample

* make embed method public

* cleaner embeddings sample output

* fix javadoc gen

* fix dep versions

* phrasing

* add AAD sample with scope

* better explanation of auth scope setting in sample

* allow mvn compile

* create and allow playback for test recordings

* change display name in ci.yml

* add codeowners

* kick off new build

* add tests.yml

* remove EnableBatchRelease field

* update to pass codegen test

* use existing label

* add ubinary to ignored words

* use proper streaming types, remove delta from ChatChoice

* rename getEmbedding to getEmbeddingList, add auto-genned method

* make getModelInfo public for java

* use Json instead of JSON in class/file name

* sync ChatChoice with TS output

* set partial-update to true

* codegen more closely synced

* use latest typespec

* add customization code

* updated typespec

* App Config Correlation Context update + yaml hint fix (Azure#41607)

* Updating correlation context to use pipeline context

* Fixing yaml hints

* Updating property docs from yaml

* removing unused imports

* Use code customizations to map internal Storage error in generated code (Azure#41624)

Use code customizations to map internal Storage error in generated code

* Add namespaces (packages) to packageInfo (Azure#41639)

* Add namespaces (packages) to packageInfo

* Actually name the script correctly

* Fix incorrect parameter name

* correct fail the step if no namespaces can be determined for one of the libraries being processed

* Fix the pom file to remove the duplicate org.apache.maven.plugins:maven-jar-plugin definition

* turn off docs for spring-cloud-azure-appconfiguration-config-web until it actually generates docs

* Updates for feedback

* Fix dependency version issue

* Publish code coverage results from 1 to2 (Azure#41656)

* Update PublishCodeCoverageResults task version from 1 to 2

* Add prerequisite task

* last commit missed a file needing a save

* Fix typo (Azure#41658)

* prepare for 1.2.27 bom release (Azure#41659)

* Move logging token acquisition to VERBOSE (Azure#41648)

* Sync eng/common directory with azure-sdk-tools for PR 8875 (Azure#41660)

* chore(): add playwright-testing to product slugs

* Update eng/common/scripts/Test-SampleMetadata.ps1

---------

Co-authored-by: Siddharth Singha Roy <[email protected]>
Co-authored-by: Wes Haggard <[email protected]>

* [App Configuration] Add test case for feature management lib (Azure#41498)

* add feature management common test cases

* add test case for no filters

* initialize feature manager and call `featureManager.isEnabled()` to compare the result

* update the schema of test case

* get sample file and tests file by listFiles api

* update the todo comment.
Throw exception and use little endian are breaking change, will have both when update to 6.xx version.

* use `getContextClassLoader().getResource` to get the resource folder path

* address comment: typo wording error fix, add "@SuppressWarnings"

* address comment: typo wording error fix

* address comment: update member name

* add running log

* use contains to filter out the "TargetingFilter.sample.json"

* add some info log

* sort the file list

* move to another the package to avoid making feature manager construction as public

* address comment: use logging, remove else

* address comment: throw exception when empty "feature_management" section.

* address comment: rename symbol

* Update ValidationsTest.java

* fixing linting

* address comment: ignore both targeting filter test case

---------

Co-authored-by: Matt Metcalf <[email protected]>

* Retrieve TokenCredential from ConfigurableBootstrapContext for env post processor (Azure#41580)

* get TokenCredential from ConfigurableBootstrapContext

---------

Co-authored-by: Muyao <[email protected]>
Co-authored-by: Muyao Feng <[email protected]>

* [Automation] Generate SDK based on TypeSpec 0.20.0 (Azure#41666)

* [Automation] Generate SDK based on TypeSpec 0.20.0

* update assets.json

* revert healthinsights changes

---------

Co-authored-by: Haoling Dong <[email protected]>

* add customization to unfinalize base classes

* more typespec syncs

* correct doc comment

* make extra parameters public

* fix bad gen

* remove dupe imports

* sync with typespec

* add lint exception for PagedFlux

* lint fixes

* App Config Correlation Context update + yaml hint fix (Azure#41607)

* Updating correlation context to use pipeline context

* Fixing yaml hints

* Updating property docs from yaml

* removing unused imports

* [OpenAI-Assistant] Added support for 2024-07-01 (Azure#41464)

* Added support 2024-07-01 service API version (Azure#41473)

* Default to sub config file paths/svc connection for public + sovereign live tests (Azure#41267)

* remove azure.xml dependency

* make completeWithResponse public

* make complete with options public

* add string constructor for ChatRequestUserMessage

* add scopes to ClientBuilders, change parameters in FunctionDefinition to BinaryData type

* update comment

* correct string constructor for ChatRequestUserMessage

* formatting

* add streaming tool call sample

* add Mono<Response<>> completeWithResponse API to AsyncClient

* better implementation of completeWithResponse

* remove unused import

* add embedWithResponse API to embeddings clients

* add tests for complete(options) and completeWithResponse APIs

* more sync tests

* add stream response test

* add completeStreamWithResponse test, change completeStreaming to completeStream

* new test recordings

* changes for TypeSpec sync

* fix pom error

* add deleted file

* restore deleted files

* restore more deleted files

* even more deleted files

* pull in openai changes from main

* more deleted files

* unmod openai file

* update HTTP client link

* spacing for typespec gen

* update dependencies

* spacing

* spacing

* spacing

* update min jacoco settings

* trigger CI build

* Naive implementations of new APIs fromContentItems and file constructor for ChatMessageImageContentItem

* spacing

* add image read sample and correct API implementations

* sanity check, cleaner syntax, and samples style fixes

* Add ImageUrlChatSample

* update dependency version

* typespec sync

* review feedback

* Update sdk/ai/azure-ai-inference/README.md

Co-authored-by: Bill Wert <[email protected]>

* Update sdk/ai/azure-ai-inference/README.md

Co-authored-by: Bill Wert <[email protected]>

* fix TypeSpec crash

* remove unneeded paragraph

* make TypeSpec sync happy

* add access helper to ChatCompletionsOptions

* typespec sync

* review feedback

---------

Co-authored-by: Matthew Metcalf <[email protected]>
Co-authored-by: Alan Zimmer <[email protected]>
Co-authored-by: James Suplizio <[email protected]>
Co-authored-by: Shawn Fang <[email protected]>
Co-authored-by: Bill Wert <[email protected]>
Co-authored-by: Azure SDK Bot <[email protected]>
Co-authored-by: Siddharth Singha Roy <[email protected]>
Co-authored-by: Wes Haggard <[email protected]>
Co-authored-by: ivywei0125 <[email protected]>
Co-authored-by: Xiaolu Dai <[email protected]>
Co-authored-by: Muyao <[email protected]>
Co-authored-by: Muyao Feng <[email protected]>
Co-authored-by: Haoling Dong <[email protected]>
Co-authored-by: Ben Broderick Phillips <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues
Projects
None yet
3 participants