Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class AudienceErrorHandlingPolicy(SansIOHTTPPolicy):
"""
A policy to handle audience-related authentication errors for Azure App Configuration.
Raises a ClientAuthenticationError with a helpful message if the audience is missing or incorrect.

:param has_audience: Indicates if the expected audience is set for the authentication token.
:type has_audience: bool
"""

def __init__(self, has_audience: bool = False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from ._audience_error_handling_policy import AudienceErrorHandlingPolicy


class AzureAppConfigurationClient:
class AzureAppConfigurationClient: # pylint: disable=docstring-keyword-should-match-keyword-only
"""Represents a client that calls restful API of Azure App Configuration service.

:param str base_url: Base url of the service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@


class AppConfigRequestsCredentialsPolicy(HTTPPolicy):
"""Implementation of request-oauthlib except and retry logic."""
"""Implementation of request-oauthlib except and retry logic.

:param credential: The credential used to authenticate requests.
:type credential: ~azure.core.credentials.AzureKeyCredential
:param str endpoint: The App Configuration endpoint.
:param str id_credential: The credential identifier used to sign requests.
"""

def __init__(self, credential: AzureKeyCredential, endpoint: str, id_credential: str):
super(AppConfigRequestsCredentialsPolicy, self).__init__()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,18 @@ def _to_generated(self) -> KeyValue:


class FeatureFlagConfigurationSetting(ConfigurationSetting): # pylint: disable=too-many-instance-attributes
"""A configuration setting that stores a feature flag value."""
"""A configuration setting that stores a feature flag value.

:param feature_id: The identity of the configuration setting.
:type feature_id: str
:keyword enabled: The value indicating whether the feature flag is enabled.
A feature is OFF if enabled is false. If enabled is true, then the feature is ON
if there are no conditions or if all conditions are satisfied. Default value is False.
:paramtype enabled: bool
:keyword filters: Filters that must run on the client and be evaluated as true for the feature
to be considered enabled.
:paramtype filters: list[dict[str, Any]] or None
"""

etag: str
"""A value representing the current state of the resource."""
Expand Down Expand Up @@ -289,7 +300,13 @@ def _to_generated(self) -> KeyValue:


class SecretReferenceConfigurationSetting(ConfigurationSetting):
"""A configuration value that references a configuration setting secret."""
"""A configuration value that references a configuration setting secret.

:param key: The key of the configuration setting.
:type key: str
:param secret_id: The identifier of the secret referenced by this configuration setting.
:type secret_id: str
"""

etag: str
"""A value representing the current state of the resource."""
Expand Down Expand Up @@ -405,7 +422,15 @@ def _to_generated(self) -> KeyValue:


class ConfigurationSettingsFilter:
"""Enables filtering of configuration settings."""
"""Enables filtering of configuration settings.

:keyword key: Filters configuration settings by their key field. Required.
:paramtype key: str
:keyword label: Filters configuration settings by their label field.
:paramtype label: str or None
:keyword tags: Filters key-values by their tags field.
:paramtype tags: list[str] or None
"""

key: str
"""Filters configuration settings by their key field. Required."""
Expand All @@ -429,7 +454,25 @@ def __init__(self, *, key: str, label: Optional[str] = None, tags: Optional[List


class ConfigurationSnapshot: # pylint: disable=too-many-instance-attributes
"""A point-in-time snapshot of configuration settings."""
"""A point-in-time snapshot of configuration settings.

:param filters: A list of filters used to filter the key-values included in the configuration snapshot.
Required.
:type filters: list[~azure.appconfiguration.ConfigurationSettingsFilter]
:keyword composition_type: The composition type describes how the key-values within the configuration
snapshot are composed. The 'key' composition type ensures there are no two key-values
containing the same key. The 'key_label' composition type ensures there are no two key-values
containing the same key and label. Known values are: "key" and "key_label".
:paramtype composition_type: str or None
:keyword retention_period: The amount of time, in seconds, that a configuration snapshot will remain in the
archived state before expiring. This property is only writable during the creation of a configuration
snapshot. If not specified, the default lifetime of key-value revisions will be used.
:paramtype retention_period: int or None
:keyword tags: The tags of the configuration snapshot.
:paramtype tags: dict[str, str] or None
:keyword description: The description of the configuration snapshot.
:paramtype description: str or None
"""

name: Optional[str]
"""The name of the configuration snapshot."""
Expand Down Expand Up @@ -584,7 +627,11 @@ def _to_generated(self) -> GeneratedConfigurationSnapshot:


class ConfigurationSettingLabel:
"""The label info of a configuration setting."""
"""The label info of a configuration setting.

:keyword name: The configuration setting label name.
:paramtype name: str or None
"""

name: Optional[str]
"""The name of the ConfigurationSetting label."""
Expand All @@ -602,7 +649,11 @@ def _return_deserialized_and_headers(_, deserialized, response_headers):


class ConfigurationSettingPropertiesPagedBase: # pylint:disable=too-many-instance-attributes
"""Base class for iterable of ConfigurationSetting properties."""
"""Base class for iterable of ConfigurationSetting properties.

:param command: The command to execute for pagination.
:type command: Callable
"""

etag: str
"""The current etag"""
Expand Down Expand Up @@ -672,7 +723,11 @@ def _extract_data_cb_base(self, get_next_return) -> tuple:
class ConfigurationSettingPropertiesPaged(
ConfigurationSettingPropertiesPagedBase, PageIterator
): # pylint:disable=too-many-instance-attributes
"""An iterable of ConfigurationSetting properties."""
"""An iterable of ConfigurationSetting properties.

:param command: The command to execute for pagination.
:type command: Callable
"""

def __init__(self, command: Callable, **kwargs: Any):
super().__init__(command, **kwargs)
Expand Down Expand Up @@ -733,7 +788,11 @@ def __next__(self) -> Iterator[ReturnType]:
class ConfigurationSettingPropertiesPagedAsync(
ConfigurationSettingPropertiesPagedBase, AsyncPageIterator
): # pylint:disable=too-many-instance-attributes
"""An iterable of ConfigurationSetting properties."""
"""An iterable of ConfigurationSetting properties.

:param command: The command to execute for pagination.
:type command: Callable
"""

def __init__(self, command: Callable, **kwargs: Any):
ConfigurationSettingPropertiesPagedBase.__init__(self, command, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def from_sync_token_string(cls, sync_token):
return None


class SyncTokenPolicy(SansIOHTTPPolicy):
class SyncTokenPolicy(SansIOHTTPPolicy): # pylint: disable=docstring-keyword-should-match-keyword-only
"""A simple policy that enable the given callback with the response.

:keyword callback raw_response_hook: Callback function. Will be invoked on response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from .._audience_error_handling_policy import AudienceErrorHandlingPolicy


class AzureAppConfigurationClient:
class AzureAppConfigurationClient: # pylint: disable=docstring-keyword-should-match-keyword-only
"""Represents a client that calls restful API of Azure App Configuration service.

:param str base_url: Base url of the service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from .._sync_token import SyncToken


class AsyncSyncTokenPolicy(SansIOHTTPPolicy):
class AsyncSyncTokenPolicy(SansIOHTTPPolicy): # pylint: disable=docstring-keyword-should-match-keyword-only
"""A simple policy that enable the given callback with the response.

:keyword callback raw_response_hook: Callback function. Will be invoked on response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license information.
# --------------------------------------------------------------------------

from azure.appconfiguration._audience import get_audience
from azure.appconfiguration._audience import get_audience # pylint: disable=no-cross-package-private-import

# Expected scope constants
_EXPECTED_PUBLIC_CLOUD_AUDIENCE = "https://appconfig.azure.com/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from testcase import AppConfigTestCase
from consts import APPCONFIGURATION_ENDPOINT_STRING
from devtools_testutils import EnvironmentVariableLoader, recorded_by_proxy
from azure.appconfiguration._audience_error_handling_policy import (
from azure.appconfiguration._audience_error_handling_policy import ( # pylint: disable=no-cross-package-private-import

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't the correct way to fix this. I've already created an issue to have tests/samples ignore some of these warning. #48308

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

what is the correct approach? Matthew Metcalf (@mrm9084)

AudienceErrorHandlingPolicy,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from consts import APPCONFIGURATION_ENDPOINT_STRING
from devtools_testutils import EnvironmentVariableLoader
from devtools_testutils.aio import recorded_by_proxy_async
from azure.appconfiguration._audience_error_handling_policy import (
from azure.appconfiguration._audience_error_handling_policy import ( # pylint: disable=no-cross-package-private-import
AudienceErrorHandlingPolicy,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# -------------------------------------------------------------------------
import pytest
from azure.core.exceptions import ClientAuthenticationError
from azure.appconfiguration._audience_error_handling_policy import (
from azure.appconfiguration._audience_error_handling_policy import ( # pylint: disable=no-cross-package-private-import
AudienceErrorHandlingPolicy,
AAD_AUDIENCE_ERROR_CODE,
NO_AUDIENCE_ERROR_MESSAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,9 @@ def send(self, request: PipelineRequest, **kwargs) -> PipelineResponse:
def new_method(request):
request.http_request.headers["Authorization"] = str(uuid4())

from azure.appconfiguration._azure_appconfiguration_requests import AppConfigRequestsCredentialsPolicy
from azure.appconfiguration._azure_appconfiguration_requests import ( # pylint: disable=no-cross-package-private-import
AppConfigRequestsCredentialsPolicy,
)

# Store the method to restore later
temp = AppConfigRequestsCredentialsPolicy._signed_request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,9 @@ async def send(self, request: PipelineRequest, **kwargs) -> PipelineResponse:
def new_method(request):
request.http_request.headers["Authorization"] = str(uuid4())

from azure.appconfiguration._azure_appconfiguration_requests import AppConfigRequestsCredentialsPolicy
from azure.appconfiguration._azure_appconfiguration_requests import ( # pylint: disable=no-cross-package-private-import
AppConfigRequestsCredentialsPolicy,
)

# Store the method to restore later
temp = AppConfigRequestsCredentialsPolicy._signed_request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
SecretReferenceConfigurationSetting,
FILTER_PERCENTAGE,
)
from azure.appconfiguration._generated.models import (
from azure.appconfiguration._generated.models import ( # pylint: disable=no-cross-package-private-import
KeyValue,
KeyValueFilter,
Snapshot as GeneratedSnapshot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline.transport import HttpRequest
from azure.core.pipeline import PipelineRequest
from azure.appconfiguration._azure_appconfiguration_requests import (
from azure.appconfiguration._azure_appconfiguration_requests import ( # pylint: disable=no-cross-package-private-import
AppConfigRequestsCredentialsPolicy,
)
from azure.appconfiguration._utils import parse_connection_string
from azure.appconfiguration._utils import parse_connection_string # pylint: disable=no-cross-package-private-import


def test_parse_connection_string_returns_http_endpoint():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import pytest
from azure.core.pipeline.transport import HttpRequest
from azure.core.pipeline import PipelineRequest
from azure.appconfiguration._query_param_policy import QueryParamPolicy
from azure.appconfiguration._query_param_policy import ( # pylint: disable=no-cross-package-private-import
QueryParamPolicy,
)

TEST_URL = "https://example.com"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.core.pipeline import PipelineRequest, PipelineResponse
from azure.appconfiguration._sync_token import SyncToken, SyncTokenPolicy
from azure.appconfiguration._sync_token import ( # pylint: disable=no-cross-package-private-import
SyncToken,
SyncTokenPolicy,
)


def test_parse_sync_token():
Expand Down
Loading