azure-storage-files-datalake
Loading...
Searching...
No Matches
datalake_path_client.hpp
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#pragma once
5
6#include "azure/storage/files/datalake/datalake_file_system_client.hpp"
7#include "azure/storage/files/datalake/datalake_options.hpp"
8#include "azure/storage/files/datalake/datalake_responses.hpp"
9
10#include <azure/core/credentials/credentials.hpp>
11#include <azure/core/internal/http/pipeline.hpp>
12#include <azure/core/response.hpp>
13#include <azure/storage/blobs/blob_client.hpp>
14#include <azure/storage/common/storage_credential.hpp>
15
16#include <cstdint>
17#include <memory>
18#include <string>
19#include <vector>
20
21namespace Azure { namespace Storage { namespace Files { namespace DataLake {
22
27 public:
32 virtual ~DataLakePathClient() = default;
33
43 const std::string& connectionString,
44 const std::string& fileSystemName,
45 const std::string& path,
47
55 const std::string& pathUrl,
56 std::shared_ptr<StorageSharedKeyCredential> credential,
58
66 const std::string& pathUrl,
67 std::shared_ptr<const Core::Credentials::TokenCredential> credential,
69
76 const std::string& pathUrl,
78
85 std::string GetUrl() const { return m_blobClient.GetUrl(); }
86
97 Azure::Response<Models::CreatePathResult> Create(
99 const CreatePathOptions& options = CreatePathOptions(),
100 const Azure::Core::Context& context = Azure::Core::Context()) const;
101
113 Azure::Response<Models::CreatePathResult> CreateIfNotExists(
115 const CreatePathOptions& options = CreatePathOptions(),
116 const Azure::Core::Context& context = Azure::Core::Context()) const;
117
126 Azure::Response<Models::DeletePathResult> Delete(
127 const DeletePathOptions& options = DeletePathOptions(),
128 const Azure::Core::Context& context = Azure::Core::Context()) const;
129
138 Azure::Response<Models::DeletePathResult> DeleteIfExists(
139 const DeletePathOptions& options = DeletePathOptions(),
140 const Azure::Core::Context& context = Azure::Core::Context()) const;
141
156 Azure::Response<Models::SetPathAccessControlListResult> SetAccessControlList(
157 std::vector<Models::Acl> acls,
159 const Azure::Core::Context& context = Azure::Core::Context()) const;
160
172 Azure::Response<Models::SetPathPermissionsResult> SetPermissions(
173 std::string permissions,
175 const Azure::Core::Context& context = Azure::Core::Context()) const;
176
187 Azure::Response<Models::SetPathHttpHeadersResult> SetHttpHeaders(
188 Models::PathHttpHeaders httpHeaders,
190 const Azure::Core::Context& context = Azure::Core::Context()) const;
191
203 Azure::Response<Models::PathProperties> GetProperties(
205 const Azure::Core::Context& context = Azure::Core::Context()) const;
206
215 Azure::Response<Models::PathAccessControlList> GetAccessControlList(
217 const Azure::Core::Context& context = Azure::Core::Context()) const;
218
229 Azure::Response<Models::SetPathMetadataResult> SetMetadata(
230 Storage::Metadata metadata,
232 const Azure::Core::Context& context = Azure::Core::Context()) const;
233
247 const std::vector<Models::Acl>& acls,
250 const Azure::Core::Context& context = Azure::Core::Context()) const
251 {
252 return SetAccessControlListRecursiveInternal(
253 Models::_detail::PathSetAccessControlListRecursiveMode::Set, acls, options, context);
254 }
255
269 const std::vector<Models::Acl>& acls,
272 const Azure::Core::Context& context = Azure::Core::Context()) const
273 {
274 return SetAccessControlListRecursiveInternal(
275 Models::_detail::PathSetAccessControlListRecursiveMode::Modify, acls, options, context);
276 }
277
291 const std::vector<Models::Acl>& acls,
294 const Azure::Core::Context& context = Azure::Core::Context()) const
295 {
296 return SetAccessControlListRecursiveInternal(
297 Models::_detail::PathSetAccessControlListRecursiveMode::Remove, acls, options, context);
298 }
299
300 protected:
302 Azure::Core::Url m_pathUrl;
303
305 Blobs::BlobClient m_blobClient;
306
308 std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
309
311 _detail::DatalakeClientConfiguration m_clientConfiguration;
312
323 Azure::Core::Url pathUrl,
324 Blobs::BlobClient blobClient,
325 std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> pipeline,
326 _detail::DatalakeClientConfiguration clientConfiguration)
327 : m_pathUrl(std::move(pathUrl)), m_blobClient(std::move(blobClient)),
328 m_pipeline(std::move(pipeline)), m_clientConfiguration(std::move(clientConfiguration))
329 {
330 }
331
332 private:
333 SetPathAccessControlListRecursivePagedResponse SetAccessControlListRecursiveInternal(
334 Models::_detail::PathSetAccessControlListRecursiveMode mode,
335 const std::vector<Models::Acl>& acls,
337 const Azure::Core::Context& context) const;
338
339 friend class DataLakeFileSystemClient;
340 friend class DataLakeLeaseClient;
341 };
342}}}} // namespace Azure::Storage::Files::DataLake
The DataLakeFileSystemClient allows you to manipulate Azure Storage DataLake files.
Definition datalake_file_system_client.hpp:28
DataLakeLeaseClient allows you to manipulate Azure Storage leases on filesystems and paths.
Definition datalake_lease_client.hpp:19
The DataLakePathClient allows you to manipulate Azure Storage DataLake files.
Definition datalake_path_client.hpp:26
Azure::Response< Models::SetPathAccessControlListResult > SetAccessControlList(std::vector< Models::Acl > acls, const SetPathAccessControlListOptions &options=SetPathAccessControlListOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets the owner, group, and access control list for a file or directory. Note that Hierarchical Namesp...
Azure::Response< Models::SetPathMetadataResult > SetMetadata(Storage::Metadata metadata, const SetPathMetadataOptions &options=SetPathMetadataOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets the metadata of a resource the path points to.
Azure::Response< Models::PathProperties > GetProperties(const GetPathPropertiesOptions &options=GetPathPropertiesOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Get Properties returns all system and user defined properties for a path. Get Status returns all syst...
static DataLakePathClient CreateFromConnectionString(const std::string &connectionString, const std::string &fileSystemName, const std::string &path, const DataLakeClientOptions &options=DataLakeClientOptions())
Create from connection string.
RemovePathAccessControlListRecursivePagedResponse RemoveAccessControlListRecursive(const std::vector< Models::Acl > &acls, const RemovePathAccessControlListRecursiveOptions &options=RemovePathAccessControlListRecursiveOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Removes POSIX access control rights on files and directories under given directory recursively.
Definition datalake_path_client.hpp:290
DataLakePathClient(const std::string &pathUrl, std::shared_ptr< const Core::Credentials::TokenCredential > credential, const DataLakeClientOptions &options=DataLakeClientOptions())
Bearer token authentication client.
Blobs::BlobClient m_blobClient
Blob Client for this path client.
Definition datalake_path_client.hpp:305
DataLakePathClient(const std::string &pathUrl, const DataLakeClientOptions &options=DataLakeClientOptions())
Anonymous/SAS/customized pipeline auth.
std::shared_ptr< Azure::Core::Http::_internal::HttpPipeline > m_pipeline
Http Pipeline.
Definition datalake_path_client.hpp:308
Azure::Response< Models::PathAccessControlList > GetAccessControlList(const GetPathAccessControlListOptions &options=GetPathAccessControlListOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Returns all access control list stored for the given path.
SetPathAccessControlListRecursivePagedResponse SetAccessControlListRecursive(const std::vector< Models::Acl > &acls, const SetPathAccessControlListRecursiveOptions &options=SetPathAccessControlListRecursiveOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets POSIX access control rights on files and directories under given directory recursively.
Definition datalake_path_client.hpp:246
Azure::Response< Models::SetPathPermissionsResult > SetPermissions(std::string permissions, const SetPathPermissionsOptions &options=SetPathPermissionsOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets the owner, group, and permissions for a file or directory. Note that Hierarchical Namespace must...
Azure::Response< Models::SetPathHttpHeadersResult > SetHttpHeaders(Models::PathHttpHeaders httpHeaders, const SetPathHttpHeadersOptions &options=SetPathHttpHeadersOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets the properties of a resource the path points to.
DataLakePathClient(Azure::Core::Url pathUrl, Blobs::BlobClient blobClient, std::shared_ptr< Azure::Core::Http::_internal::HttpPipeline > pipeline, _detail::DatalakeClientConfiguration clientConfiguration)
Construct a new DataLakePathClient.
Definition datalake_path_client.hpp:322
_detail::DatalakeClientConfiguration m_clientConfiguration
Client configurations.
Definition datalake_path_client.hpp:311
Azure::Response< Models::DeletePathResult > DeleteIfExists(const DeletePathOptions &options=DeletePathOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Deletes the resource the path points to if it exists.
DataLakePathClient(const std::string &pathUrl, std::shared_ptr< StorageSharedKeyCredential > credential, const DataLakeClientOptions &options=DataLakeClientOptions())
Shared key authentication client.
std::string GetUrl() const
Gets the path's primary URL endpoint. This is the endpoint used for blob storage available features i...
Definition datalake_path_client.hpp:85
Azure::Response< Models::CreatePathResult > CreateIfNotExists(Models::PathResourceType type, const CreatePathOptions &options=CreatePathOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Creates a file or directory. By default, the destination is not changed if it already exists.
Azure::Response< Models::DeletePathResult > Delete(const DeletePathOptions &options=DeletePathOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Deletes the resource the path points to.
Azure::Response< Models::CreatePathResult > Create(Models::PathResourceType type, const CreatePathOptions &options=CreatePathOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Creates a file or directory. By default, the destination is overwritten and if the destination alread...
UpdatePathAccessControlListRecursivePagedResponse UpdateAccessControlListRecursive(const std::vector< Models::Acl > &acls, const UpdatePathAccessControlListRecursiveOptions &options=UpdatePathAccessControlListRecursiveOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Updates POSIX access control rights on files and directories under given directory recursively.
Definition datalake_path_client.hpp:268
Azure::Core::Url m_pathUrl
Url to the resource on the service.
Definition datalake_path_client.hpp:302
virtual ~DataLakePathClient()=default
Destructor.
Required only for Create File and Create Directory. The value must be "file" or "directory".
Definition rest_client.hpp:126
Response type for Azure::Storage::Files::DataLake::DataLakePathClient::SetAccessControlListRecursive.
Definition datalake_responses.hpp:879
Optional parameters for Azure::Storage::Files::DataLake::DataLakePathClient::Create.
Definition datalake_options.hpp:657
Client options used to initialize all DataLake clients.
Definition datalake_options.hpp:160
Optional parameters for Azure::Storage::Files::DataLake::DirectoryClient::Delete.
Definition datalake_options.hpp:745
Optional parameters for Azure::Storage::Files::DataLake::DataLakePathClient::GetAccessControlList.
Definition datalake_options.hpp:789
Optional parameters for Azure::Storage::Files::DataLake::DataLakePathClient::GetProperties.
Definition datalake_options.hpp:766
Optional parameters for Azure::Storage::Files::DataLake::DataLakePathClient::SetAccessControlList.
Definition datalake_options.hpp:560
Optional parameters for DirectoryClient::SetAccessControlListRecursive.
Definition datalake_options.hpp:894
Optional parameters for Azure::Storage::Files::DataLake::DataLakeFileClient::SetHttpHeaders.
Definition datalake_options.hpp:604
Optional parameters for Azure::Storage::Files::DataLake::DataLakePathClient::SetMetadata.
Definition datalake_options.hpp:616
Optional parameters for Azure::Storage::Files::DataLake::DataLakePathClient::SetPermissions.
Definition datalake_options.hpp:582