Skip to content

Commit

Permalink
Update Blob SAS generation sample documents. Fixed #7676 (Azure#10956)
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoningLiu authored Sep 1, 2020
1 parent 09164ea commit 2794060
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
21 changes: 10 additions & 11 deletions sdk/storage/storage-blob/src/BlobSASSignatureValues.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { BlobSASPermissions } from "./BlobSASPermissions";
import { UserDelegationKey } from "./BlobServiceClient";
import { ContainerSASPermissions } from "./ContainerSASPermissions";
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
import { SasIPRange, ipRangeToString } from "./SasIPRange";
import { SASProtocol } from "./SASQueryParameters";
import { SASQueryParameters } from "./SASQueryParameters";
import { UserDelegationKeyCredential } from "./credentials/UserDelegationKeyCredential";
import { UserDelegationKey } from "./BlobServiceClient";
import { ipRangeToString, SasIPRange } from "./SasIPRange";
import { SASProtocol, SASQueryParameters } from "./SASQueryParameters";
import { SERVICE_VERSION } from "./utils/constants";
import { truncatedISO8061Date } from "./utils/utils.common";


/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
Expand Down Expand Up @@ -176,8 +175,8 @@ export interface BlobSASSignatureValues {
* const containerSAS = generateBlobSASQueryParameters({
* containerName, // Required
* permissions: ContainerSASPermissions.parse("racwdl"), // Required
* startsOn: new Date(), // Required
* expiresOn: new Date(new Date().valueOf() + 86400), // Optional. Date type
* startsOn: new Date(), // Optional
* expiresOn: new Date(new Date().valueOf() + 86400), // Required. Date type
* ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, // Optional
* protocol: SASProtocol.HttpsAndHttp, // Optional
* version: "2016-05-31" // Optional
Expand Down Expand Up @@ -220,8 +219,8 @@ export interface BlobSASSignatureValues {
* containerName, // Required
* blobName, // Required
* permissions: BlobSASPermissions.parse("racwd"), // Required
* startsOn: new Date(), // Required
* expiresOn: new Date(new Date().valueOf() + 86400), // Optional. Date type
* startsOn: new Date(), // Optional
* expiresOn: new Date(new Date().valueOf() + 86400), // Required. Date type
* cacheControl: "cache-control-override", // Optional
* contentDisposition: "content-disposition-override", // Optional
* contentEncoding: "content-encoding-override", // Optional
Expand Down Expand Up @@ -259,8 +258,8 @@ export function generateBlobSASQueryParameters(
* const containerSAS = generateBlobSASQueryParameters({
* containerName, // Required
* permissions: ContainerSASPermissions.parse("racwdl"), // Required
* startsOn, // Required. Date type
* expiresOn, // Optional. Date type
* startsOn, // Optional. Date type
* expiresOn, // Required. Date type
* ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, // Optional
* protocol: SASProtocol.HttpsAndHttp, // Optional
* version: "2018-11-09" // Must >= 2018-11-09 to generate user delegation SAS
Expand Down
25 changes: 12 additions & 13 deletions sdk/storage/storage-file-datalake/src/DataLakeSASSignatureValues.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { DataLakeSASPermissions } from "./DataLakeSASPermissions";
import { FileSystemSASPermissions } from "./FileSystemSASPermissions";
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
import { SasIPRange, ipRangeToString } from "./SasIPRange";
import { SASProtocol } from "./SASQueryParameters";
import { SASQueryParameters } from "./SASQueryParameters";
import { UserDelegationKeyCredential } from "./credentials/UserDelegationKeyCredential";
import { DataLakeSASPermissions } from "./DataLakeSASPermissions";
import { FileSystemSASPermissions } from "./FileSystemSASPermissions";
import { UserDelegationKey } from "./models";
import { ipRangeToString, SasIPRange } from "./SasIPRange";
import { SASProtocol, SASQueryParameters } from "./SASQueryParameters";
import { SERVICE_VERSION } from "./utils/constants";
import { truncatedISO8061Date } from "./utils/utils.common";
import { UserDelegationKey } from "./models";


/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
Expand Down Expand Up @@ -166,8 +165,8 @@ export interface DataLakeSASSignatureValues {
* const containerSAS = generateDataLakeSASQueryParameters({
* fileSystemName, // Required
* permissions: ContainerSASPermissions.parse("racwdl"), // Required
* startsOn: new Date(), // Required
* expiresOn: new Date(new Date().valueOf() + 86400), // Optional. Date type
* startsOn: new Date(), // Optional
* expiresOn: new Date(new Date().valueOf() + 86400), // Required. Date type
* ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, // Optional
* protocol: SASProtocol.HttpsAndHttp, // Optional
* version: "2016-05-31" // Optional
Expand All @@ -184,8 +183,8 @@ export interface DataLakeSASSignatureValues {
* fileSystemName, // Required
* fileName, // Required
* permissions: DataLakeSASPermissions.parse("racwd"), // Required
* startsOn: new Date(), // Required
* expiresOn: new Date(new Date().valueOf() + 86400), // Optional. Date type
* startsOn: new Date(), // Optional
* expiresOn: new Date(new Date().valueOf() + 86400), // Required. Date type
* cacheControl: "cache-control-override", // Optional
* contentDisposition: "content-disposition-override", // Optional
* contentEncoding: "content-encoding-override", // Optional
Expand Down Expand Up @@ -222,8 +221,8 @@ export function generateDataLakeSASQueryParameters(
* const fileSystemSAS = generateDataLakeSASQueryParameters({
* fileSystemName, // Required
* permissions: FileSystemSASPermissions.parse("racwdl"), // Required
* startsOn, // Required. Date type
* expiresOn, // Optional. Date type
* startsOn, // Optional. Date type
* expiresOn, // Required. Date type
* ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, // Optional
* protocol: SASProtocol.HttpsAndHttp, // Optional
* version: "2018-11-09" // Must >= 2018-11-09 to generate user delegation SAS
Expand Down

0 comments on commit 2794060

Please sign in to comment.