Esempio n. 1
0
        /// <summary>
        /// Deletes the content from the external storage medium associated with the provider.
        /// </summary>
        /// <param name="file">The file.</param>
        public override void DeleteContent(BinaryFile file)
        {
            var bucketName     = GetBucketName();
            var accountKeyJson = GetServiceAccountKeyJson();
            var googleObject   = TranslateBinaryFileToGoogleObject(file);

            GoogleCloudStorage.DeleteObject(bucketName, accountKeyJson, false, googleObject.Name);
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes the asset. If Asset.Key is not provided then one is created using the RootFolder and Asset.Name.
        /// If Key is provided then it MUST use the full path, RootFolder is not used.
        /// </summary>
        /// <param name="assetStorageProvider"></param>
        /// <param name="asset">The asset.</param>
        /// <returns></returns>
        public override bool DeleteAsset(AssetStorageProvider assetStorageProvider, Asset asset)
        {
            var rootFolder = GetRootFolder(assetStorageProvider);

            FixKey(asset, rootFolder);

            var bucketName     = GetBucketName(assetStorageProvider);
            var accountKeyJson = GetServiceAccountKeyJson(assetStorageProvider);
            var isFolder       = asset.Type == AssetType.Folder;

            GoogleCloudStorage.DeleteObject(bucketName, accountKeyJson, isFolder, asset.Key);
            return(true);
        }