Skip to content

Commit 025ee58

Browse files
Merge pull request #2 from LibbaLawrence/settingUpTestInfrastructure
Setting up test infrastructure
2 parents b53e56a + 2d59dc2 commit 025ee58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+14112
-0
lines changed

sdk/Table/azure/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore

sdk/Table/azure/storage/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore

sdk/Table/azure/storage/tables/__init__.py

Whitespace-only changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
# pylint: disable=unused-argument
7+
8+
from azure.core.exceptions import ResourceExistsError
9+
10+
from ._shared.models import StorageErrorCode
11+
from ._models import QueueProperties
12+
13+
14+
def deserialize_metadata(response, obj, headers):
15+
raw_metadata = {k: v for k, v in response.headers.items() if k.startswith("x-ms-meta-")}
16+
return {k[10:]: v for k, v in raw_metadata.items()}
17+
18+
19+
def deserialize_queue_properties(response, obj, headers):
20+
metadata = deserialize_metadata(response, obj, headers)
21+
queue_properties = QueueProperties(
22+
metadata=metadata,
23+
**headers
24+
)
25+
return queue_properties
26+
27+
28+
def deserialize_queue_creation(response, obj, headers):
29+
if response.status_code == 204:
30+
error_code = StorageErrorCode.queue_already_exists
31+
error = ResourceExistsError(
32+
message="Queue already exists\nRequestId:{}\nTime:{}\nErrorCode:{}".format(
33+
headers['x-ms-request-id'],
34+
headers['Date'],
35+
error_code
36+
),
37+
response=response)
38+
error.error_code = error_code
39+
error.additional_info = {}
40+
raise error
41+
return headers
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from ._azure_table import AzureTable
8+
__all__ = ['AzureTable']
9+
10+
try:
11+
from ._patch import patch_sdk
12+
patch_sdk()
13+
except ImportError:
14+
pass
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from typing import TYPE_CHECKING
8+
9+
from azure.core import PipelineClient
10+
from msrest import Deserializer, Serializer
11+
12+
if TYPE_CHECKING:
13+
# pylint: disable=unused-import,ungrouped-imports
14+
from typing import Any
15+
16+
from ._configuration import AzureTableConfiguration
17+
from .operations import TableOperations
18+
from .operations import ServiceOperations
19+
from . import models
20+
21+
22+
class AzureTable(object):
23+
"""AzureTable.
24+
25+
:ivar table: TableOperations operations
26+
:vartype table: azure_table.operations.TableOperations
27+
:ivar service: ServiceOperations operations
28+
:vartype service: azure_table.operations.ServiceOperations
29+
:param url: The URL of the service account or table that is the targe of the desired operation.
30+
:type url: str
31+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
32+
"""
33+
34+
def __init__(
35+
self,
36+
url, # type: str
37+
**kwargs # type: Any
38+
):
39+
# type: (...) -> None
40+
base_url = '{url}'
41+
self._config = AzureTableConfiguration(url, **kwargs)
42+
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
43+
44+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
45+
self._serialize = Serializer(client_models)
46+
self._deserialize = Deserializer(client_models)
47+
48+
self.table = TableOperations(
49+
self._client, self._config, self._serialize, self._deserialize)
50+
self.service = ServiceOperations(
51+
self._client, self._config, self._serialize, self._deserialize)
52+
53+
def close(self):
54+
# type: () -> None
55+
self._client.close()
56+
57+
def __enter__(self):
58+
# type: () -> AzureTable
59+
self._client.__enter__()
60+
return self
61+
62+
def __exit__(self, *exc_details):
63+
# type: (Any) -> None
64+
self._client.__exit__(*exc_details)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from typing import TYPE_CHECKING
8+
9+
from azure.core.configuration import Configuration
10+
from azure.core.pipeline import policies
11+
12+
if TYPE_CHECKING:
13+
# pylint: disable=unused-import,ungrouped-imports
14+
from typing import Any
15+
16+
VERSION = "unknown"
17+
18+
class AzureTableConfiguration(Configuration):
19+
"""Configuration for AzureTable.
20+
21+
Note that all parameters used to create this instance are saved as instance
22+
attributes.
23+
24+
:param url: The URL of the service account or table that is the targe of the desired operation.
25+
:type url: str
26+
"""
27+
28+
def __init__(
29+
self,
30+
url, # type: str
31+
**kwargs # type: Any
32+
):
33+
# type: (...) -> None
34+
if url is None:
35+
raise ValueError("Parameter 'url' must not be None.")
36+
super(AzureTableConfiguration, self).__init__(**kwargs)
37+
38+
self.url = url
39+
self.version = "2019-02-02"
40+
kwargs.setdefault('sdk_moniker', 'azuretable/{}'.format(VERSION))
41+
self._configure(**kwargs)
42+
43+
def _configure(
44+
self,
45+
**kwargs # type: Any
46+
):
47+
# type: (...) -> None
48+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
49+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
50+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
51+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
52+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
53+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
54+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
55+
self.authentication_policy = kwargs.get('authentication_policy')
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from ._azure_table_async import AzureTable
8+
__all__ = ['AzureTable']
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from typing import Any
8+
9+
from azure.core import AsyncPipelineClient
10+
from msrest import Deserializer, Serializer
11+
12+
from ._configuration_async import AzureTableConfiguration
13+
from .operations_async import TableOperations
14+
from .operations_async import ServiceOperations
15+
from .. import models
16+
17+
18+
class AzureTable(object):
19+
"""AzureTable.
20+
21+
:ivar table: TableOperations operations
22+
:vartype table: azure_table.aio.operations_async.TableOperations
23+
:ivar service: ServiceOperations operations
24+
:vartype service: azure_table.aio.operations_async.ServiceOperations
25+
:param url: The URL of the service account or table that is the targe of the desired operation.
26+
:type url: str
27+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
28+
"""
29+
30+
def __init__(
31+
self,
32+
url: str,
33+
**kwargs: Any
34+
) -> None:
35+
base_url = '{url}'
36+
self._config = AzureTableConfiguration(url, **kwargs)
37+
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
38+
39+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
40+
self._serialize = Serializer(client_models)
41+
self._deserialize = Deserializer(client_models)
42+
43+
self.table = TableOperations(
44+
self._client, self._config, self._serialize, self._deserialize)
45+
self.service = ServiceOperations(
46+
self._client, self._config, self._serialize, self._deserialize)
47+
48+
async def close(self) -> None:
49+
await self._client.close()
50+
51+
async def __aenter__(self) -> "AzureTable":
52+
await self._client.__aenter__()
53+
return self
54+
55+
async def __aexit__(self, *exc_details) -> None:
56+
await self._client.__aexit__(*exc_details)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from typing import Any
8+
9+
from azure.core.configuration import Configuration
10+
from azure.core.pipeline import policies
11+
12+
VERSION = "unknown"
13+
14+
class AzureTableConfiguration(Configuration):
15+
"""Configuration for AzureTable.
16+
17+
Note that all parameters used to create this instance are saved as instance
18+
attributes.
19+
20+
:param url: The URL of the service account or table that is the targe of the desired operation.
21+
:type url: str
22+
"""
23+
24+
def __init__(
25+
self,
26+
url: str,
27+
**kwargs: Any
28+
) -> None:
29+
if url is None:
30+
raise ValueError("Parameter 'url' must not be None.")
31+
super(AzureTableConfiguration, self).__init__(**kwargs)
32+
33+
self.url = url
34+
self.version = "2019-02-02"
35+
kwargs.setdefault('sdk_moniker', 'azuretable/{}'.format(VERSION))
36+
self._configure(**kwargs)
37+
38+
def _configure(
39+
self,
40+
**kwargs: Any
41+
) -> None:
42+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
43+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
44+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
45+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
46+
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
47+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
48+
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
49+
self.authentication_policy = kwargs.get('authentication_policy')
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6282, generator: {generator})
4+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
# --------------------------------------------------------------------------
6+
7+
from ._table_operations_async import TableOperations
8+
from ._service_operations_async import ServiceOperations
9+
10+
__all__ = [
11+
'TableOperations',
12+
'ServiceOperations',
13+
]

0 commit comments

Comments
 (0)