forked from openstacknetsdk/openstack.net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectStorageProviderExamples.fs
More file actions
29 lines (26 loc) · 1.17 KB
/
Copy pathObjectStorageProviderExamples.fs
File metadata and controls
29 lines (26 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module ObjectStorageProviderExamples
open System;
open System.Collections.Generic;
open net.openstack.Core.Domain;
open net.openstack.Core.Providers;
//#region ListObjectsInContainer
let listAllObjects(provider : IObjectStorageProvider, containerName : string) =
seq {
let lastContainerObject : ContainerObject ref = { contents = null }
let finished : bool ref = { contents = false }
while not !finished do
let marker = if !lastContainerObject <> null then (!lastContainerObject).Name else null
let containerObjects = provider.ListObjects(containerName, marker= marker)
lastContainerObject := null
for containerObject in containerObjects do
lastContainerObject := containerObject
yield containerObject
if !lastContainerObject = null then
finished := true
}
let listObjects(provider : IObjectStorageProvider, containerName : string) =
Console.WriteLine("Objects in container {0}", containerName)
for containerObject in listAllObjects(provider, containerName) do
Console.WriteLine(" {0}", containerObject.Name)
()
//#endregion