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

Quality training #14365

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2761e0b
[ApiTraining] Added training projects (#13309)
annatisch Aug 26, 2020
951177c
omit sdk/training from readme validation
scbedd Aug 26, 2020
6f99a97
[API Training] Updated readme (#13333)
annatisch Aug 26, 2020
7896da3
Rename directory
annatisch Sep 23, 2020
1701619
Added implementation skeleton
annatisch Sep 23, 2020
0bfefab
Starting position
annatisch Sep 23, 2020
6426278
Updated swagger model
annatisch Sep 23, 2020
efb277c
Removed AAD credential
annatisch Sep 28, 2020
01e715f
Fix samples
annatisch Sep 28, 2020
739f704
Updated impl project
annatisch Oct 5, 2020
0252c9b
Datetime import
annatisch Oct 5, 2020
ca1b7f0
Rename packages
annatisch Oct 5, 2020
8b893f8
First attempt at ci
annatisch Oct 5, 2020
ca372b1
Fixed samples
annatisch Oct 5, 2020
22539a9
Context manager
annatisch Oct 5, 2020
73556f8
Rename directory
annatisch Oct 5, 2020
21cc3de
beginnings of the implementation of testing for python quality unit
seankane-msft Oct 6, 2020
e1b5b82
added second unit test
seankane-msft Oct 6, 2020
f2a79d3
implementation status for quality units
seankane-msft Oct 6, 2020
05bc44c
issues with environment variables
seankane-msft Oct 6, 2020
2c89638
close on the preparer, have to check data tables publish worked properly
seankane-msft Oct 6, 2020
9a99567
updated testing file
seankane-msft Oct 7, 2020
afa41bd
starter code for the python testing tutorial
seankane-msft Oct 8, 2020
b54f615
removing my work on the implementation tutorial from the PR
seankane-msft Oct 8, 2020
87e322b
removing more of my changes
seankane-msft Oct 8, 2020
1eb836e
accidentally added stuff from the 'training' folder
seankane-msft Oct 8, 2020
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
5 changes: 5 additions & 0 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ omitted_paths:
- doc/*
- sdk/**/samples/*
- sdk/identity/azure-identity/tests/*
- sdk/training/*

language: python
root_check_enabled: True
Expand Down Expand Up @@ -96,6 +97,10 @@ known_content_issues:
- ['sdk/storage/azure-storage-queue/swagger/README.md', '#4554']
- ['sdk/storage/README.md', '#4554']
- ['sdk/textanalytics/azure-ai-textanalytics/samples/README.md', '#4554']
- ['sdk/training/azure-appconfiguration/README.md', '#4554']
- ['sdk/training/azure-appconfiguration/swagger/README.md', '#4554']
- ['sdk/training/azure-computation/README.md', '#4554']
- ['sdk/training/azure-computation/swagger/README.md', '#4554']

# nspckg and common.
- ['sdk/appconfiguration/azure-appconfiguration/README.md', 'nspkg and common']
Expand Down
8 changes: 8 additions & 0 deletions sdk/api-learn/api-design-tutorial/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Release History

-------------------

## 0.0.1 (Unreleased)

- Training day!
4 changes: 4 additions & 0 deletions sdk/api-learn/api-design-tutorial/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
recursive-include tests *.py
include *.md
include azure/__init__.py
recursive-include samples *.py *.md
38 changes: 38 additions & 0 deletions sdk/api-learn/api-design-tutorial/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Azure App Configuration client library for Python SDK Training

Azure App Configuration is a managed service that helps developers centralize their application configurations simply and securely.

Modern programs, especially programs running in a cloud, generally have many components that are distributed in nature. Spreading configuration settings across these components can lead to hard-to-troubleshoot errors during an application deployment. Use App Configuration to securely store all the settings for your application in one place.

Use the client library for App Configuration to create and manage application configuration settings.

## Prerequisites

* Python 2.7, or 3.5 or later is required to use this package.
* You need an [Azure subscription][azure_sub], and a [Configuration Store][configuration_store] to use this package.

To create a Configuration Store, you can use the Azure Portal or [Azure CLI][azure_cli].

After that, create the Configuration Store:

```Powershell
az appconfig create --name <config-store-name> --resource-group <resource-group-name> --location eastus
```


## Contributing

This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
see the Code of Conduct FAQ or contact opencode@microsoft.com with any
additional questions or comments.
7 changes: 7 additions & 0 deletions sdk/api-learn/api-design-tutorial/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------

__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------

from ._version import VERSION


__version__ = VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._azure_app_configuration import AzureAppConfiguration
__all__ = ['AzureAppConfiguration']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

from ._configuration import AzureAppConfigurationConfiguration
from .operations import AzureAppConfigurationOperationsMixin
from . import models


class AzureAppConfiguration(AzureAppConfigurationOperationsMixin):
"""AzureAppConfiguration.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: The endpoint of the App Configuration instance to send requests to.
:type endpoint: str
:param sync_token: Used to guarantee real-time consistency between requests.
:type sync_token: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
endpoint, # type: str
sync_token=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
base_url = '{endpoint}'
self._config = AzureAppConfigurationConfiguration(credential, endpoint, sync_token, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)


def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> AzureAppConfiguration
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class AzureAppConfigurationConfiguration(Configuration):
"""Configuration for AzureAppConfiguration.

Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: The endpoint of the App Configuration instance to send requests to.
:type endpoint: str
:param sync_token: Used to guarantee real-time consistency between requests.
:type sync_token: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
endpoint, # type: str
sync_token=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
super(AzureAppConfigurationConfiguration, self).__init__(**kwargs)

self.credential = credential
self.endpoint = endpoint
self.sync_token = sync_token
self.api_version = "1.0"
self.credential_scopes = kwargs.pop('credential_scopes', [])
kwargs.setdefault('sdk_moniker', 'azureappconfiguration/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if not self.credential_scopes and not self.authentication_policy:
raise ValueError("You must provide either credential_scopes or authentication_policy as kwargs")
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._azure_app_configuration_async import AzureAppConfiguration
__all__ = ['AzureAppConfiguration']
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, Optional, TYPE_CHECKING

from azure.core import AsyncPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration_async import AzureAppConfigurationConfiguration
from .operations_async import AzureAppConfigurationOperationsMixin
from .. import models


class AzureAppConfiguration(AzureAppConfigurationOperationsMixin):
"""AzureAppConfiguration.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param endpoint: The endpoint of the App Configuration instance to send requests to.
:type endpoint: str
:param sync_token: Used to guarantee real-time consistency between requests.
:type sync_token: str
"""

def __init__(
self,
credential: "AsyncTokenCredential",
endpoint: str,
sync_token: Optional[str] = None,
**kwargs: Any
) -> None:
base_url = '{endpoint}'
self._config = AzureAppConfigurationConfiguration(credential, endpoint, sync_token, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)


async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "AzureAppConfiguration":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, Optional, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

VERSION = "unknown"

class AzureAppConfigurationConfiguration(Configuration):
"""Configuration for AzureAppConfiguration.

Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param endpoint: The endpoint of the App Configuration instance to send requests to.
:type endpoint: str
:param sync_token: Used to guarantee real-time consistency between requests.
:type sync_token: str
"""

def __init__(
self,
credential: "AsyncTokenCredential",
endpoint: str,
sync_token: Optional[str] = None,
**kwargs: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
super(AzureAppConfigurationConfiguration, self).__init__(**kwargs)

self.credential = credential
self.endpoint = endpoint
self.sync_token = sync_token
self.api_version = "1.0"
self.credential_scopes = kwargs.pop('credential_scopes', [])
kwargs.setdefault('sdk_moniker', 'azureappconfiguration/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if not self.credential_scopes and not self.authentication_policy:
raise ValueError("You must provide either credential_scopes or authentication_policy as kwargs")
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Loading