1# coding=utf-8
2# --------------------------------------------------------------------------
3# Copyright (c) Microsoft Corporation. All rights reserved.
4# Licensed under the MIT License. See License.txt in the project root for
5# license information.
6#
7# Code generated by Microsoft (R) AutoRest Code Generator.
8# Changes may cause incorrect behavior and will be lost if the code is
9# regenerated.
10# --------------------------------------------------------------------------
11
12from azure.core import PipelineClient
13from msrest import Serializer, Deserializer
14
15from ._configuration import AzureBlobStorageConfiguration
16from azure.core.exceptions import map_error
17from .operations import ServiceOperations
18from .operations import ContainerOperations
19from .operations import DirectoryOperations
20from .operations import BlobOperations
21from .operations import PageBlobOperations
22from .operations import AppendBlobOperations
23from .operations import BlockBlobOperations
24from . import models
25
26
27class AzureBlobStorage(object):
28    """AzureBlobStorage
29
30
31    :ivar service: Service operations
32    :vartype service: azure.storage.blob.operations.ServiceOperations
33    :ivar container: Container operations
34    :vartype container: azure.storage.blob.operations.ContainerOperations
35    :ivar directory: Directory operations
36    :vartype directory: azure.storage.blob.operations.DirectoryOperations
37    :ivar blob: Blob operations
38    :vartype blob: azure.storage.blob.operations.BlobOperations
39    :ivar page_blob: PageBlob operations
40    :vartype page_blob: azure.storage.blob.operations.PageBlobOperations
41    :ivar append_blob: AppendBlob operations
42    :vartype append_blob: azure.storage.blob.operations.AppendBlobOperations
43    :ivar block_blob: BlockBlob operations
44    :vartype block_blob: azure.storage.blob.operations.BlockBlobOperations
45
46    :param url: The URL of the service account, container, or blob that is the
47     targe of the desired operation.
48    :type url: str
49    """
50
51    def __init__(self, url, **kwargs):
52
53        base_url = '{url}'
54        self._config = AzureBlobStorageConfiguration(url, **kwargs)
55        self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
56
57        client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
58        self.api_version = '2019-02-02'
59        self._serialize = Serializer(client_models)
60        self._deserialize = Deserializer(client_models)
61
62        self.service = ServiceOperations(
63            self._client, self._config, self._serialize, self._deserialize)
64        self.container = ContainerOperations(
65            self._client, self._config, self._serialize, self._deserialize)
66        self.directory = DirectoryOperations(
67            self._client, self._config, self._serialize, self._deserialize)
68        self.blob = BlobOperations(
69            self._client, self._config, self._serialize, self._deserialize)
70        self.page_blob = PageBlobOperations(
71            self._client, self._config, self._serialize, self._deserialize)
72        self.append_blob = AppendBlobOperations(
73            self._client, self._config, self._serialize, self._deserialize)
74        self.block_blob = BlockBlobOperations(
75            self._client, self._config, self._serialize, self._deserialize)
76
77    def __enter__(self):
78        self._client.__enter__()
79        return self
80    def __exit__(self, *exc_details):
81        self._client.__exit__(*exc_details)
82