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

Azure App Configuration Provider Beta #26016

Merged
merged 137 commits into from
Oct 13, 2022
Merged
Changes from 1 commit
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
0b71864
Adding azure-appconfiguration-provider
mrm9084 Aug 30, 2022
95e8f80
Fixing repo issue
mrm9084 Aug 30, 2022
7085b93
Fixing repo issue
mrm9084 Aug 30, 2022
2c49e9d
Updated to setup user agent and header info
mrm9084 Aug 30, 2022
c6895e9
Updating to cache secret_clients
mrm9084 Aug 30, 2022
9f1cc57
Fixed Naming
mrm9084 Aug 30, 2022
9a86e7b
Fixed Typo
mrm9084 Aug 30, 2022
5e3d409
Added Samples, Fixed issue with Key Vault Options not set when secret…
mrm9084 Sep 1, 2022
6ac7714
Fixed SP, Dependency, and Pylint issues
mrm9084 Sep 2, 2022
649e6fd
Fixed more lint issues, moved key vault references to be a method
mrm9084 Sep 2, 2022
ffd2d62
More Linting fixes
mrm9084 Sep 2, 2022
84dd770
Fixing dependency issues with build
mrm9084 Sep 2, 2022
31d2318
Updated Docs. Fixed extra code for Key Vault Usage. Updated Readme to…
mrm9084 Sep 9, 2022
0aa7e99
Adding Test Case, currently doesn't work
mrm9084 Sep 9, 2022
0aa91a5
Fixing Tests
mrm9084 Sep 19, 2022
68e20d7
Fixing Trim. Fixing Typo in readme.
mrm9084 Sep 19, 2022
7ca6cd3
Fixing Length and vault_url issues.
mrm9084 Sep 19, 2022
2c8bb78
Updating from code review comments
mrm9084 Sep 20, 2022
f7e3929
Added more error checking. Made Key_VAULT_SECRET_PREFIX a constant.
mrm9084 Sep 20, 2022
ef7a7f5
Updated to use Key Vault Identifier.
mrm9084 Sep 20, 2022
cbf2acb
Fixed Spelling
mrm9084 Sep 20, 2022
047d526
Updated Test
mrm9084 Sep 20, 2022
f379833
Reworked key vault reference resolution. Fixed lint issues.
mrm9084 Sep 20, 2022
dcb6cf7
Fixing Lint Issue. Updating Test Running
mrm9084 Sep 21, 2022
a0c6cb8
Fixing Tests
mrm9084 Sep 21, 2022
4dd0831
Fixed Tests?
mrm9084 Sep 21, 2022
d7ae7dd
Setting secret clients to {} if none. Adding override to shared_requi…
mrm9084 Sep 21, 2022
ce5863f
Merge branch 'Azure:main' into main
mrm9084 Sep 21, 2022
17b46ba
Merge branch 'main' of github.com:mrm9084/azure-sdk-for-python
mrm9084 Sep 21, 2022
3dcb5d4
Updating shared requirements
mrm9084 Sep 21, 2022
821cd09
Fixed override. Switched to SecretReferenceConfigurationSetting
mrm9084 Sep 21, 2022
22a7716
Updated Requirement KeyVaultSecretIdentifier is needed.
mrm9084 Sep 21, 2022
f67503c
Update ci.yml
mrm9084 Sep 21, 2022
34f274d
Update ci.yml
mrm9084 Sep 21, 2022
ceab535
Fixed structure
mrm9084 Sep 22, 2022
d9e75a6
Update dev_requirements.txt
mrm9084 Sep 22, 2022
8407fbc
Update sdk_packaging.toml
mrm9084 Sep 22, 2022
6ce62f5
Revert working state
mrm9084 Sep 22, 2022
95e5d30
Renamed correctly
mrm9084 Sep 22, 2022
1002b68
Merge branch 'main' into main
mrm9084 Sep 22, 2022
fdc6e98
Using azure-appconfigurationprovider
mrm9084 Sep 22, 2022
2e390e9
Merge branch 'main' of github.com:mrm9084/azure-sdk-for-python
mrm9084 Sep 22, 2022
e6d65fb
Fixing shared Requirements merge issue
mrm9084 Sep 22, 2022
4a6b17c
Updated from review comments
mrm9084 Sep 23, 2022
76c4fb9
Fixing package folder
mrm9084 Sep 23, 2022
5c2d30e
Fix lint, removed extra fixture
mrm9084 Sep 23, 2022
9171668
Create py.typed
mrm9084 Sep 23, 2022
f81281c
Updated Manifest to use right py.typed file
mrm9084 Sep 23, 2022
740ba65
Switched Files
mrm9084 Sep 23, 2022
7a436aa
Fixing lint issue
mrm9084 Sep 23, 2022
3d0a7e9
Setting defaults for test
mrm9084 Sep 24, 2022
b8faf09
Updating Docs
mrm9084 Sep 26, 2022
8efbc43
Fixing Whitespace
mrm9084 Sep 26, 2022
b2cc043
Updating to support in operation
mrm9084 Sep 26, 2022
e6619bd
Updated sample with in usage
mrm9084 Sep 26, 2022
176673a
Cleaned up key trimming usage
mrm9084 Sep 26, 2022
dfd6fac
Removed extra catches for now. Cleaned up lint.
mrm9084 Sep 27, 2022
b2bfbff
Adding more tests
mrm9084 Sep 27, 2022
75bc7e2
Fixed Linting
mrm9084 Sep 28, 2022
9639c96
Fixing Auto Format
mrm9084 Sep 29, 2022
2f07a55
Fixing Key Vault Reference Test
mrm9084 Oct 6, 2022
560be04
Trying to update the package name
mrm9084 Oct 6, 2022
f340a5e
Fixed formatting?
mrm9084 Oct 6, 2022
dc943c3
Adding azure-appconfiguration-provider
mrm9084 Aug 30, 2022
e8dec63
Fixing repo issue
mrm9084 Aug 30, 2022
9e889d0
Fixing repo issue
mrm9084 Aug 30, 2022
c3b56e5
Updated to setup user agent and header info
mrm9084 Aug 30, 2022
86cd913
Updating to cache secret_clients
mrm9084 Aug 30, 2022
1220f9d
Fixed Naming
mrm9084 Aug 30, 2022
9e48429
Fixed Typo
mrm9084 Aug 30, 2022
0b15d1a
Added Samples, Fixed issue with Key Vault Options not set when secret…
mrm9084 Sep 1, 2022
8aa4762
Fixed SP, Dependency, and Pylint issues
mrm9084 Sep 2, 2022
4fdfb56
Fixed more lint issues, moved key vault references to be a method
mrm9084 Sep 2, 2022
b87beee
More Linting fixes
mrm9084 Sep 2, 2022
b237292
Fixing dependency issues with build
mrm9084 Sep 2, 2022
8335a1a
Updated Docs. Fixed extra code for Key Vault Usage. Updated Readme to…
mrm9084 Sep 9, 2022
b097b0f
Adding Test Case, currently doesn't work
mrm9084 Sep 9, 2022
1f57085
Fixing Tests
mrm9084 Sep 19, 2022
2bd138e
Fixing Trim. Fixing Typo in readme.
mrm9084 Sep 19, 2022
14487de
Fixing Length and vault_url issues.
mrm9084 Sep 19, 2022
262ba3d
Updating from code review comments
mrm9084 Sep 20, 2022
8dec35a
Added more error checking. Made Key_VAULT_SECRET_PREFIX a constant.
mrm9084 Sep 20, 2022
cd5af67
Updated to use Key Vault Identifier.
mrm9084 Sep 20, 2022
5c888b4
Fixed Spelling
mrm9084 Sep 20, 2022
689487f
Updated Test
mrm9084 Sep 20, 2022
9f0d7c7
Reworked key vault reference resolution. Fixed lint issues.
mrm9084 Sep 20, 2022
4e977ae
Fixing Lint Issue. Updating Test Running
mrm9084 Sep 21, 2022
9d0b579
Fixing Tests
mrm9084 Sep 21, 2022
47127bf
Fixed Tests?
mrm9084 Sep 21, 2022
5aa01d1
Setting secret clients to {} if none. Adding override to shared_requi…
mrm9084 Sep 21, 2022
cb71779
Updating shared requirements
mrm9084 Sep 21, 2022
ac8aa14
Fixed override. Switched to SecretReferenceConfigurationSetting
mrm9084 Sep 21, 2022
6590ae3
Updated Requirement KeyVaultSecretIdentifier is needed.
mrm9084 Sep 21, 2022
0fdaab5
Update ci.yml
mrm9084 Sep 21, 2022
a325123
Update ci.yml
mrm9084 Sep 21, 2022
ffa7a78
Fixed structure
mrm9084 Sep 22, 2022
87cf458
Update dev_requirements.txt
mrm9084 Sep 22, 2022
fe5944f
Update sdk_packaging.toml
mrm9084 Sep 22, 2022
bc9e941
Revert working state
mrm9084 Sep 22, 2022
f776454
Renamed correctly
mrm9084 Sep 22, 2022
d585fcd
Using azure-appconfigurationprovider
mrm9084 Sep 22, 2022
5a3f340
Fixing shared Requirements merge issue
mrm9084 Sep 22, 2022
4af6180
Updated from review comments
mrm9084 Sep 23, 2022
20937c8
Fixing package folder
mrm9084 Sep 23, 2022
6ea9f72
Fix lint, removed extra fixture
mrm9084 Sep 23, 2022
3157ec4
Create py.typed
mrm9084 Sep 23, 2022
e967499
Updated Manifest to use right py.typed file
mrm9084 Sep 23, 2022
c98f1f8
Switched Files
mrm9084 Sep 23, 2022
c794d46
Fixing lint issue
mrm9084 Sep 23, 2022
39eacba
Setting defaults for test
mrm9084 Sep 24, 2022
23d6fb9
Updating Docs
mrm9084 Sep 26, 2022
8c4bc04
Fixing Whitespace
mrm9084 Sep 26, 2022
9b33797
Updating to support in operation
mrm9084 Sep 26, 2022
682bd2c
Updated sample with in usage
mrm9084 Sep 26, 2022
22636cd
Cleaned up key trimming usage
mrm9084 Sep 26, 2022
784ffee
Removed extra catches for now. Cleaned up lint.
mrm9084 Sep 27, 2022
1bedd5a
Adding more tests
mrm9084 Sep 27, 2022
d28b57e
Fixed Linting
mrm9084 Sep 28, 2022
9da907d
Fixing Auto Format
mrm9084 Sep 29, 2022
f46b1ab
Fixing Key Vault Reference Test
mrm9084 Oct 6, 2022
a1feea8
Trying to update the package name
mrm9084 Oct 6, 2022
a807121
Merge branch 'main' of github.com:mrm9084/azure-sdk-for-python
mrm9084 Oct 6, 2022
abcd3d8
Merge branch 'Azure:main' into main
mrm9084 Oct 6, 2022
e1bd5b4
Removing Extra TestProxy
mrm9084 Oct 6, 2022
16c3795
Not -e installing azure-appconfiguration
mrm9084 Oct 6, 2022
acf1b9c
updates
xiangyan99 Oct 6, 2022
bea39b8
update
xiangyan99 Oct 6, 2022
9aea9e4
update
xiangyan99 Oct 6, 2022
601470f
Update sdk/appconfiguration/azure-appconfiguration-provider/setup.py
xiangyan99 Oct 7, 2022
b515416
update
xiangyan99 Oct 7, 2022
bf82613
Merge branch 'main' of https://github.com/mrm9084/azure-sdk-for-python
xiangyan99 Oct 7, 2022
5802867
Updated min version of app config
mrm9084 Oct 11, 2022
3290b6f
Updating sanitizer
mrm9084 Oct 12, 2022
b232b93
Merge branch 'main' of github.com:mrm9084/azure-sdk-for-python
mrm9084 Oct 12, 2022
16cabad
Updating Shared Requirement
mrm9084 Oct 12, 2022
fb4bc3a
Temp removing key vault test
mrm9084 Oct 12, 2022
7404333
Removing actual tests
mrm9084 Oct 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated to setup user agent and header info
mrm9084 committed Aug 30, 2022
commit 2c49e9d199b81725263eb8af5559ade2d662f888
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
from azure.appconfiguration import AzureAppConfigurationClient
from azure.keyvault.secrets import SecretClient
from ._settingselector import SettingSelector
from ._user_agent import USER_AGENT
from urllib.parse import urlparse
import json

@@ -14,25 +15,23 @@ class AzureAppConfigurationProvider:

@classmethod
def load(cls, connection_string=None, endpoint=None, credential=None, **kwargs):
"""
Requires either a connection-string, or an Endpoint with a Credential. Loads the selected configuration settings into itself for usage.
Optional parameters:
selectors (List of SettingSelector for selecting which applicationconfiguration settings to load),. If not specified, all key-values with the empty label will be loaded.
trimmed_key_prefixes (remove prefixes in key name, list of what to trim),
"""
Requires either a connection-string, or an Endpoint with a Credential. Loads the selected configuration settings into itself for usage.
Optional parameters:
selectors (List of SettingSelector for selecting which applicationconfiguration settings to load),. If not specified, all key-values with the empty label will be loaded.
trimmed_key_prefixes (remove prefixes in key name, list of what to trim),
key_vault_options (Configurations for connecting to Key Vault(s))
"""

provider = AzureAppConfigurationProvider()

if (connection_string is not None):
provider.client = AzureAppConfigurationClient.from_connection_string(
connection_string)
else:
provider.client = AzureAppConfigurationClient(endpoint, credential)
key_vault_options = kwargs.pop("key_vault_options", None)
mrm9084 marked this conversation as resolved.
Show resolved Hide resolved

provider.client = cls.buildprovider(
connection_string, endpoint, credential, key_vault_options)

selects = kwargs.pop("selects", {SettingSelector("*", "\0")})
provider.trim_prefixes = kwargs.pop("trimmed_key_prefixes", [])
key_vault_options = kwargs.pop("key_vault_options", None)
pipeline = kwargs.pop("pipeline")

provider.dict = {}

@@ -79,6 +78,28 @@ def load(cls, connection_string=None, endpoint=None, credential=None, **kwargs):
provider.dict[provider.trim(config.key)] = config.value
return provider

def buildprovider(connection_string, endpoint, credential, key_vault_options):
usesKeyVault = False

if (key_vault_options is not None and (key_vault_options.credential is not None or key_vault_options.secret_clients is not None or key_vault_options.secret_resolver is not None)):
usesKeyVault = True

headers = {}
correlationcontext = "RequestType=Startup"

if (usesKeyVault):
correlationcontext += ",UsesKeyVault"

headers["Correlation-Context"] = correlationcontext
useragent = USER_AGENT

if (connection_string is not None):
return AzureAppConfigurationClient.from_connection_string(
connection_string, user_agent=useragent, headers=headers)
else:
return AzureAppConfigurationClient(
endpoint, credential, user_agent=useragent, headers=headers)

def trim(self, key):
for trim in self.trim_prefixes:
if key.startswith(trim):
Original file line number Diff line number Diff line change
@@ -6,6 +6,6 @@
from ._version import VERSION
from azure.appconfiguration._version import VERSION as SDK_VERSION

USER_AGENT = "python-appconfigurationprovider/{} azsdk-python-appconfiguration/{} Python/{} ({})".format(
VERSION, SDK_VERSION, platform.python_version(), platform.platform()
USER_AGENT = "python-appconfigurationprovider/{}".format(
VERSION
)