Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage][stg74] Delegation SAS v2 and Directory SAS #11395

Merged
merged 5 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,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 @@ -233,28 +237,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 @@ -693,8 +706,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 @@ -1494,7 +1511,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";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be changed in blob, queue and file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for now. Can log an issue if we think it's needed.

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