Skip to content

Commit

Permalink
[storage][stg74] Delegation SAS v2 and Directory SAS (#11395)
Browse files Browse the repository at this point in the history
* move under sas/

* wip

* wip

* test wip

* autofill directoryDepth
  • Loading branch information
ljian3377 authored Sep 24, 2020
1 parent 58a959d commit 2e8784e
Show file tree
Hide file tree
Showing 14 changed files with 950 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ export class AccountSASPermissions {
add: boolean;
create: boolean;
delete: boolean;
execute: boolean;
list: boolean;
move: boolean;
ownership: boolean;
static parse(permissions: string): AccountSASPermissions;
permission: boolean;
process: boolean;
read: boolean;
toString(): string;
Expand Down Expand Up @@ -259,28 +263,37 @@ export class DataLakeSASPermissions {
add: boolean;
create: boolean;
delete: boolean;
execute: boolean;
move: boolean;
ownership: boolean;
static parse(permissions: string): DataLakeSASPermissions;
permission: boolean;
read: boolean;
toString(): string;
write: boolean;
}

// @public
export interface DataLakeSASSignatureValues {
authorizedUserObjectId?: string;
cacheControl?: string;
contentDisposition?: string;
contentEncoding?: string;
contentLanguage?: string;
contentType?: string;
correlationId?: string;
directoryDepth?: number;
expiresOn?: Date;
fileSystemName: string;
identifier?: string;
ipRange?: SasIPRange;
isDirectory?: boolean;
pathName?: string;
permissions?: DataLakeSASPermissions;
protocol?: SASProtocol;
snapshotTime?: string;
startsOn?: Date;
unauthorizedUserObjectId?: string;
version?: string;
}

Expand Down Expand Up @@ -725,8 +738,12 @@ export class FileSystemSASPermissions {
add: boolean;
create: boolean;
delete: boolean;
execute: boolean;
list: boolean;
move: boolean;
ownership: boolean;
static parse(permissions: string): FileSystemSASPermissions;
permission: boolean;
read: boolean;
toString(): string;
write: boolean;
Expand Down Expand Up @@ -1545,7 +1562,7 @@ export enum SASProtocol {

// @public
export class SASQueryParameters {
constructor(version: string, signature: string, permissions?: string, services?: string, resourceTypes?: string, protocol?: SASProtocol, startsOn?: Date, expiresOn?: Date, ipRange?: SasIPRange, identifier?: string, resource?: string, cacheControl?: string, contentDisposition?: string, contentEncoding?: string, contentLanguage?: string, contentType?: string, userDelegationKey?: UserDelegationKey);
constructor(version: string, signature: string, permissions?: string, services?: string, resourceTypes?: string, protocol?: SASProtocol, startsOn?: Date, expiresOn?: Date, ipRange?: SasIPRange, identifier?: string, resource?: string, cacheControl?: string, contentDisposition?: string, contentEncoding?: string, contentLanguage?: string, contentType?: string, userDelegationKey?: UserDelegationKey, directoryDepth?: number, authorizedUserObjectId?: string, unauthorizedUserObjectId?: string, correlationId?: string);
readonly cacheControl?: string;
readonly contentDisposition?: string;
readonly contentEncoding?: string;
Expand Down
18 changes: 9 additions & 9 deletions sdk/storage/storage-file-datalake/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export * from "./DataLakeServiceClient";
export * from "./DataLakeFileSystemClient";
export * from "./clients";
export * from "./DataLakeLeaseClient";
export * from "./AccountSASPermissions";
export * from "./AccountSASResourceTypes";
export * from "./AccountSASServices";
export * from "./AccountSASSignatureValues";
export * from "./DataLakeSASPermissions";
export * from "./DataLakeSASSignatureValues";
export * from "./FileSystemSASPermissions";
export * from "./sas/AccountSASPermissions";
export * from "./sas/AccountSASResourceTypes";
export * from "./sas/AccountSASServices";
export * from "./sas/AccountSASSignatureValues";
export * from "./sas/DataLakeSASPermissions";
export * from "./sas/DataLakeSASSignatureValues";
export * from "./sas/FileSystemSASPermissions";
export * from "./StorageBrowserPolicyFactory";
export * from "./credentials/AnonymousCredential";
export * from "./credentials/Credential";
Expand All @@ -21,10 +21,10 @@ export * from "./policies/AnonymousCredentialPolicy";
export * from "./policies/CredentialPolicy";
export * from "./StorageRetryPolicyFactory";
export * from "./policies/StorageSharedKeyCredentialPolicy";
export * from "./SASQueryParameters";
export * from "./sas/SASQueryParameters";
export * from "./models";
export { CommonOptions } from "./StorageClient";
export { SasIPRange } from "./SasIPRange";
export { SasIPRange } from "./sas/SasIPRange";
export { ToBlobEndpointHostMappings, ToDfsEndpointHostMappings } from "./utils/constants";
export { RestError } from "@azure/core-http";
export { logger } from "./log";
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import { AccountSASPermissions } from "./AccountSASPermissions";
import { AccountSASResourceTypes } from "./AccountSASResourceTypes";
import { AccountSASServices } from "./AccountSASServices";
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
import { StorageSharedKeyCredential } from "../credentials/StorageSharedKeyCredential";
import { SasIPRange, ipRangeToString } from "./SasIPRange";
import { SASProtocol, SASQueryParameters } from "./SASQueryParameters";
import { SERVICE_VERSION } from "./utils/constants";
import { truncatedISO8061Date } from "./utils/utils.common";
import { SERVICE_VERSION } from "../utils/constants";
import { truncatedISO8061Date } from "../utils/utils.common";

/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ export class DataLakeSASPermissions {
case "d":
blobSASPermissions.delete = true;
break;
case "m":
blobSASPermissions.move = true;
break;
case "e":
blobSASPermissions.execute = true;
break;
case "o":
blobSASPermissions.ownership = true;
break;
case "p":
blobSASPermissions.permission = true;
break;
default:
throw new RangeError(`Invalid permission: ${char}`);
}
Expand Down Expand Up @@ -91,6 +103,38 @@ export class DataLakeSASPermissions {
*/
public delete: boolean = false;

/**
* Specifies Move access granted.
*
* @type {boolean}
* @memberof DirectorySASPermissions
*/
public move: boolean = false;

/**
* Specifies Execute access granted.
*
* @type {boolean}
* @memberof DirectorySASPermissions
*/
public execute: boolean = false;

/**
* Specifies Ownership access granted.
*
* @type {boolean}
* @memberof DirectorySASPermissions
*/
public ownership: boolean = false;

/**
* Specifies Permission access granted.
*
* @type {boolean}
* @memberof DirectorySASPermissions
*/
public permission: boolean = false;

/**
* Converts the given permissions to a string. Using this method will guarantee the permissions are in an
* order accepted by the service.
Expand All @@ -115,6 +159,18 @@ export class DataLakeSASPermissions {
if (this.delete) {
permissions.push("d");
}
if (this.move) {
permissions.push("m");
}
if (this.execute) {
permissions.push("e");
}
if (this.ownership) {
permissions.push("o");
}
if (this.permission) {
permissions.push("p");
}
return permissions.join("");
}
}
Loading

0 comments on commit 2e8784e

Please sign in to comment.