How to use the azure-storage.BlobUtilities.SharedAccessPermissions function in azure-storage

To help you get started, we’ve selected a few azure-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / BatchExplorer / src / app / components / common / resourcefile-picker / resourcefile-cloud-file-dialog / resourcefile-cloud-file-dialog.component.spec.ts View on Github external
it("call the container service to get SAS for container", () => {
                expect(blobServiceSpy.list).toHaveBeenCalledOnce();
                expect(blobServiceSpy.list).toHaveBeenCalledWith("new-storage-acc-1", "foobar", {
                    folder: "path/to/folder",
                    limit: 1,
                }, true);

                expect(containerServiceSpy.generateSharedAccessUrl).toHaveBeenCalled();
                expect(containerServiceSpy.generateSharedAccessUrl).toHaveBeenCalledWith(
                    "new-storage-acc-1", "foobar", {
                        AccessPolicy: jasmine.objectContaining({
                            Permissions: BlobUtilities.SharedAccessPermissions.READ,
                        }),
                    });
            });
github Azure / BatchExplorer / src / app / components / common / resourcefile-picker / resourcefile-cloud-file-dialog / resourcefile-cloud-file-dialog.component.spec.ts View on Github external
it("calls the blob service to generate SAS ", () => {
                expect(blobServiceSpy.list).toHaveBeenCalledOnce();
                expect(blobServiceSpy.list).toHaveBeenCalledWith("auto-storage-id", "foobar", {
                    folder: "path/to/file.sh",
                    limit: 1,
                }, true);
                expect(blobServiceSpy.generateSharedAccessBlobUrl).toHaveBeenCalledOnce();
                expect(blobServiceSpy.generateSharedAccessBlobUrl).toHaveBeenCalledWith(
                    "auto-storage-id", "foobar", "path/to/file.sh", {
                        AccessPolicy: jasmine.objectContaining({
                            Permissions: BlobUtilities.SharedAccessPermissions.READ,
                        }),
                    });
            });
github Azure / BatchExplorer / src / app / components / common / resourcefile-picker / resourcefile-cloud-file-dialog / resourcefile-cloud-file-dialog.component.ts View on Github external
private _createResourceFileFromBlob(
        storageAccountId: string,
        containerName: string,
        file: string): Observable {

        const sas: SharedAccessPolicy = {
            AccessPolicy: {
                Permissions: BlobUtilities.SharedAccessPermissions.READ,
                Start: new Date(),
                Expiry: DateTime.local().plus({ weeks: 1 }).toJSDate(),
            },
        };

        return this.blobService.generateSharedAccessBlobUrl(
            storageAccountId,
            containerName,
            file,
            sas).pipe(
                map((httpUrl) => {
                    return { httpUrl, filePath: "" };
                }),
            );
    }
github Azure / BatchExplorer / app / components / task / base / resourcefile-picker.component.ts View on Github external
flatMap((result) => {
                        this.uploadingFiles = this.uploadingFiles.filter(x => x !== nodeFilePath);
                        this.changeDetector.detectChanges();
                        const sas: SharedAccessPolicy = {
                            AccessPolicy: {
                                Permissions: BlobUtilities.SharedAccessPermissions.READ,
                                Start: new Date(),
                                Expiry: moment().add(1, "week").toDate(),
                            },
                        };
                        return this.storageBlobService.generateSharedAccessBlobUrl(storageAccountId,
                            this._containerId,
                            blobName,
                            sas).pipe(tap((url) => {
                                this._addResourceFile(url, nodeFilePath);
                            }));
                    }),
                );
github Azure / BatchExplorer / src / app / components / common / resourcefile-picker / resourcefile-picker.component.ts View on Github external
flatMap((result) => {
                        this.uploadingFiles = this.uploadingFiles.filter(x => x !== nodeFilePath);
                        this.changeDetector.detectChanges();
                        const sas: SharedAccessPolicy = {
                            AccessPolicy: {
                                Permissions: BlobUtilities.SharedAccessPermissions.READ,
                                Start: new Date(),
                                Expiry: DateTime.local().plus({ weeks: 1 }).toJSDate(),
                            },
                        };
                        return this.storageBlobService.generateSharedAccessBlobUrl(storageAccountId,
                            this._containerId,
                            blobName,
                            sas).pipe(tap((url) => {
                                this._addResourceFile(url, nodeFilePath);
                            }));
                    }),
                );