OCISDK/OCISDK/ObjectStorage/IO/ObjectStorageDirectoryInfo.cs
/// <summary>
/// Returns the directory in the s-bucket to the specified pattern
/// </summary>
/// <param name="searchPattern"></param>
/// <param name="searchOption"></param>
/// <returns></returns>
Returns the directory in the s-bucket to the specified pattern
Returns the directory in the s - bucket to the specified pattern
public IEnumerable<ObjectStorageDirectoryInfo> EnumerateDirectories(string searchPattern, SearchOption searchOption)
        {
            IEnumerable<ObjectStorageDirectoryInfo> folders = null;
            if (String.IsNullOrEmpty(BucketName))
            {
                var request = new ListBucketsRequest();
                folders = Client.ListBuckets(request).Items
                    .ConvertAll(bucket => new ObjectStorageDirectoryInfo(Client, NamespaceName, bucket.Name, ""));
            }
            else
            {
                var prefixs = GetOciPrefixs(ObjectKey, searchOption);
                folders = prefixs.ToList()
                    .ConvertAll(f => new ObjectStorageDirectoryInfo(Client, NamespaceName, BucketName, ObjectStorageHelper.DecodeKey(f)));
            }
            var regEx = WildcardToRegex(searchPattern);
            folders = folders.Where(f => Regex.IsMatch(f.Name, regEx, RegexOptions.IgnoreCase));
            return folders;
        }
public IEnumerable < ObjectStorageDirectoryInfo > EnumerateDirectories ( string searchPattern , SearchOption searchOption ) { IEnumerable < ObjectStorageDirectoryInfo > folders = null ; if ( String . IsNullOrEmpty ( BucketName ) ) { var request = new ListBucketsRequest ( ) ; folders = Client . ListBuckets ( request ) . Items . ConvertAll ( bucket => new ObjectStorageDirectoryInfo ( Client , NamespaceName , bucket . Name , " " ) ) ; } else { var prefixs = GetOciPrefixs ( ObjectKey , searchOption ) ; folders = prefixs . ToList ( ) . ConvertAll ( f => new ObjectStorageDirectoryInfo ( Client , NamespaceName , BucketName , ObjectStorageHelper . DecodeKey ( f ) ) ) ; } var regEx = WildcardToRegex ( searchPattern ) ; folders = folders . Where ( f => Regex . IsMatch ( f . Name , regEx , RegexOptions . IgnoreCase ) ) ; return folders ; }
Returns the directory in the s-bucket to the specified pattern
Returns the directory in the s - bucket to the specified pattern
//filter based on search pattern
None
searchPattern
string
None
searchOption
SearchOption
None