DataLakePathClient class
DataLakePathClient 表示 Azure 存储路径(目录或文件)的 URL。
- 扩展
-
StorageClient
构造函数
Data |
从 URL 和管道创建 DataLakePathClient 的实例。 |
Data |
从 URL 和凭据创建 DataLakePathClient 的实例。 |
属性
file |
当前文件系统的名称。 |
name | 当前路径的名称(目录或文件)。 |
继承属性
account |
|
credential | 例如 AnonymousCredential、StorageSharedKeyCredential 或任何来自 |
url | 编码的 URL 字符串值。 |
方法
构造函数详细信息
DataLakePathClient(string, Pipeline)
从 URL 和管道创建 DataLakePathClient 的实例。
new DataLakePathClient(url: string, pipeline: Pipeline)
参数
- url
-
string
指向 Azure 存储 Data Lake 路径(目录或文件)的客户端字符串,例如“https://myaccount.dfs.core.windows.net/filesystem/directory"或“https://myaccount.dfs.core.windows.net/filesystem/file"。 如果使用 AnonymousCredential(如“https://myaccount.dfs.core.windows.net/filesystem/directory?sasString"),则可以追加 SAS。
- pipeline
- Pipeline
调用 newPipeline()以创建默认管道,或提供自定义管道。
DataLakePathClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)
从 URL 和凭据创建 DataLakePathClient 的实例。
new DataLakePathClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
参数
- url
-
string
指向 Azure 存储 Data Lake 路径(目录或文件)的客户端字符串,例如“https://myaccount.dfs.core.windows.net/filesystem/directory"或“https://myaccount.dfs.core.windows.net/filesystem/file"。 如果使用 AnonymousCredential(如“https://myaccount.dfs.core.windows.net/filesystem/directory?sasString"),则可以追加 SAS。
- credential
-
StorageSharedKeyCredential | AnonymousCredential | TokenCredential
例如 AnonymousCredential、StorageSharedKeyCredential 或任何来自 @azure/identity
包的凭据,用于对服务的请求进行身份验证。 还可以提供实现 TokenCredential 接口的对象。 如果未指定,则使用 AnonymousCredential。
- options
- StoragePipelineOptions
自选。 用于配置 HTTP 管道的选项。
属性详细信息
fileSystemName
当前文件系统的名称。
string fileSystemName
属性值
string
name
当前路径的名称(目录或文件)。
string name
属性值
string
继承属性详细信息
accountName
accountName: string
属性值
string
继承自 StorageClient.accountName
credential
例如 AnonymousCredential、StorageSharedKeyCredential 或任何来自 @azure/identity
包的凭据,用于对服务的请求进行身份验证。 还可以提供实现 TokenCredential 接口的对象。 如果未指定,则使用 AnonymousCredential。
credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential
属性值
继承自 StorageClient.credential
url
编码的 URL 字符串值。
url: string
属性值
string
继承自 StorageClient.url
方法详细信息
create(PathResourceTypeModel, PathCreateOptions)
创建目录或路径。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create
function create(resourceType: PathResourceTypeModel, options?: PathCreateOptions): Promise<PathCreateResponse>
参数
- resourceType
- PathResourceTypeModel
资源类型“directory”或“file”。
- options
- PathCreateOptions
自选。 创建路径时的选项。
返回
Promise<PathCreateResponse>
createIfNotExists(PathResourceTypeModel, PathCreateIfNotExistsOptions)
创建目录或文件。 如果资源已存在,则不会更改。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create
function createIfNotExists(resourceType: PathResourceTypeModel, options?: PathCreateIfNotExistsOptions): Promise<PathCreateIfNotExistsResponse>
参数
- resourceType
- PathResourceTypeModel
资源类型“directory”或“file”。
- options
- PathCreateIfNotExistsOptions
返回
Promise<PathCreateIfNotExistsResponse>
delete(boolean, PathDeleteOptions)
删除当前路径(目录或文件)。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete
function delete(recursive?: boolean, options?: PathDeleteOptions): Promise<PathDeleteResponse>
参数
- recursive
-
boolean
仅当资源是目录时才必需且有效。 如果为“true”,将删除目录下的所有路径。
- options
- PathDeleteOptions
自选。 删除路径时的选项。
返回
Promise<PathDeleteResponse>
deleteIfExists(boolean, PathDeleteOptions)
如果存在,请删除当前路径(目录或文件)。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete
function deleteIfExists(recursive?: boolean, options?: PathDeleteOptions): Promise<PathDeleteIfExistsResponse>
参数
- recursive
-
boolean
仅当资源是目录时才必需且有效。 如果为“true”,将删除目录下的所有路径。
- options
- PathDeleteOptions
返回
Promise<PathDeleteIfExistsResponse>
exists(PathExistsOptions)
如果此客户端表示的 Data Lake 文件存在,则返回 true;否则为 false。
注意:请谨慎使用此函数,因为现有文件可能被其他客户端或应用程序删除。 反之亦然,此函数完成后,其他客户端或应用程序可能会添加新文件。
function exists(options?: PathExistsOptions): Promise<boolean>
参数
- options
- PathExistsOptions
“存在”作的选项。
返回
Promise<boolean>
getAccessControl(PathGetAccessControlOptions)
返回路径(文件目录)的访问控制数据。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/getproperties
function getAccessControl(options?: PathGetAccessControlOptions): Promise<PathGetAccessControlResponse>
参数
- options
- PathGetAccessControlOptions
自选。 获取文件访问控制时的选项。
返回
Promise<PathGetAccessControlResponse>
getDataLakeLeaseClient(string)
获取管理路径(目录或文件)上的租约的 DataLakeLeaseClient。
function getDataLakeLeaseClient(proposeLeaseId?: string): DataLakeLeaseClient
参数
- proposeLeaseId
-
string
自选。 初始建议的租约 ID。
返回
getProperties(PathGetPropertiesOptions)
返回路径(目录或文件)的所有用户定义的元数据、标准 HTTP 属性和系统属性。
警告:响应中返回的 metadata
对象将具有小写形式的键,即使它们最初包含大写字符也是如此。 这不同于 dataLakeFileSystemClient 方法返回的元数据键,这些元数据键使用 includeMetadata
选项列出路径,该选项将保留其原始大小写。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-properties
function getProperties(options?: PathGetPropertiesOptions): Promise<PathGetPropertiesResponse>
参数
- options
- PathGetPropertiesOptions
自选。 获取路径属性时的选项。
返回
Promise<PathGetPropertiesResponse>
move(string, PathMoveOptions)
在同一文件系统中移动目录或文件。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create
function move(destinationPath: string, options?: PathMoveOptions): Promise<PathMoveResponse>
参数
- destinationPath
-
string
目标目录路径,如“directory”或文件路径“directory/file”。 如果 destinationPath 使用 SAS 进行身份验证,请将 SAS 添加到目标路径,例如“directory/file?sasToken”。
- options
- PathMoveOptions
自选。 移动目录或文件时的选项。
返回
Promise<PathMoveResponse>
move(string, string, PathMoveOptions)
将目录或文件移动到另一个文件系统。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create
function move(destinationFileSystem: string, destinationPath: string, options?: PathMoveOptions): Promise<PathMoveResponse>
参数
- destinationFileSystem
-
string
目标文件系统,如“filesystem”。
- destinationPath
-
string
目标目录路径(如“directory”或文件路径“directory/file”)如果 destinationPath 使用 SAS 进行身份验证,请将 SAS 添加到目标路径,例如“directory/file?sasToken”。
- options
- PathMoveOptions
自选。 移动目录或文件时的选项。
返回
Promise<PathMoveResponse>
removeAccessControlRecursive(RemovePathAccessControlItem[], PathChangeAccessControlRecursiveOptions)
删除路径和子路径上的访问控制。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update
function removeAccessControlRecursive(acl: RemovePathAccessControlItem[], options?: PathChangeAccessControlRecursiveOptions): Promise<PathChangeAccessControlRecursiveResponse>
参数
文件或目录的 POSIX 访问控制列表。
自选。 选项
返回
setAccessControl(PathAccessControlItem[], PathSetAccessControlOptions)
设置路径(文件目录)的访问控制数据。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update
function setAccessControl(acl: PathAccessControlItem[], options?: PathSetAccessControlOptions): Promise<PathSetAccessControlResponse>
参数
- acl
文件或目录的 POSIX 访问控制列表。
- options
- PathSetAccessControlOptions
自选。 设置路径访问控制时的选项。
返回
Promise<PathSetAccessControlResponse>
setAccessControlRecursive(PathAccessControlItem[], PathChangeAccessControlRecursiveOptions)
设置路径和子路径上的访问控制。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update
function setAccessControlRecursive(acl: PathAccessControlItem[], options?: PathChangeAccessControlRecursiveOptions): Promise<PathChangeAccessControlRecursiveResponse>
参数
- acl
文件或目录的 POSIX 访问控制列表。
自选。 选项
返回
setHttpHeaders(PathHttpHeaders, PathSetHttpHeadersOptions)
在路径(目录或文件)上设置系统属性。
如果未提供任何值,或者未为指定的 Blob HTTP 标头提供任何值,则清除不带值的这些 blob HTTP 标头。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-properties
function setHttpHeaders(httpHeaders: PathHttpHeaders, options?: PathSetHttpHeadersOptions): Promise<PathSetHttpHeadersResponse>
参数
- httpHeaders
- PathHttpHeaders
- options
- PathSetHttpHeadersOptions
返回
Promise<PathSetHttpHeadersResponse>
setMetadata(Metadata, PathSetMetadataOptions)
将指定路径(文件目录)的用户定义元数据设置为一个或多个名称值对。
如果未提供任何选项,或者参数中未定义任何元数据,将删除路径元数据。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata
function setMetadata(metadata?: Metadata, options?: PathSetMetadataOptions): Promise<PathSetMetadataResponse>
参数
- metadata
- Metadata
自选。 将现有元数据替换为此值。 如果未提供任何值,将删除现有元数据。
- options
- PathSetMetadataOptions
自选。 设置路径元数据时的选项。
返回
Promise<PathSetMetadataResponse>
setPermissions(PathPermissions, PathSetPermissionsOptions)
设置路径上的文件权限。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update
function setPermissions(permissions: PathPermissions, options?: PathSetPermissionsOptions): Promise<PathSetPermissionsResponse>
参数
- permissions
- PathPermissions
文件所有者、文件拥有组和其他文件的 POSIX 访问权限。
- options
- PathSetPermissionsOptions
自选。 设置路径权限时的选项。
返回
Promise<PathSetPermissionsResponse>
toDirectoryClient()
如果当前路径是目录,请将当前 DataLakePathClient 转换为 DataLakeDirectoryClient。
function toDirectoryClient(): DataLakeDirectoryClient
返回
toFileClient()
如果当前路径为文件,请将当前 DataLakePathClient 转换为 DataLakeFileClient。
function toFileClient(): DataLakeFileClient
返回
updateAccessControlRecursive(PathAccessControlItem[], PathChangeAccessControlRecursiveOptions)
修改路径和子路径上的访问控制。
请参阅 https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update
function updateAccessControlRecursive(acl: PathAccessControlItem[], options?: PathChangeAccessControlRecursiveOptions): Promise<PathChangeAccessControlRecursiveResponse>
参数
- acl
文件或目录的 POSIX 访问控制列表。
自选。 选项