Skip to content

Handle Files vs Directories #7

Description

@araddon

The current Object implementation assumes it is a file, and doesn't have any affordance for directory only types. https://golang.org/pkg/os/#FileMode

Google Storage has a Delimiter for filtering to certain types

https://developers.google.com/apis-explorer/#p/storage/v1/storage.objects.list?bucket=lytics-dataux-tests&delimiter=%252F&maxResults=1000&prefix=tables%252F&_h=8&

Limiting to directories with Delimiter = "/"

{
 "kind": "storage#objects",
 "prefixes": [
  "tables/article/",
  "tables/user/"
 ]
}

Regular objects

https://developers.google.com/apis-explorer/#p/storage/v1/storage.objects.list?bucket=lytics-dataux-tests&maxResults=1000&prefix=tables%252F&_h=7&

{
 "kind": "storage#objects",
 "items": [
  {


   "kind": "storage#object",
   "id": "lytics-dataux-tests/tables/article/article1.csv/1457896488161000",
   "selfLink": "https://www.googleapis.com/storage/v1/b/lytics-dataux-tests/o/tables%2Farticle%2Farticle1.csv",
   "name": "tables/article/article1.csv",
   "bucket": "lytics-dataux-tests",
   "generation": "1457896488161000",
   "metageneration": "1",
   "contentType": "text/csv; charset=utf-8",
   "timeCreated": "2016-03-13T19:14:48.119Z",
   "updated": "2016-03-13T19:14:48.119Z",
   "storageClass": "STANDARD",
   "size": "398",
   "md5Hash": "+RTyIckctKnUmha0OaBBHA==",
   "mediaLink": "https://www.googleapis.com/download/storage/v1/b/lytics-dataux-tests/o/tables%2Farticle%2Farticle1.csv?generation=1457896488161000&alt=media",
   "metadata": {
    "content_type": "text/csv; charset=utf-8"
   },
   "owner": {
    "entity": "user-00b4903a9730f58d42103a7fd40a4d0f92e371ae57112475d3993f88ccf7e8d6",
    "entityId": "00b4903a9730f58d42103a7fd40a4d0f92e371ae57112475d3993f88ccf7e8d6"
   },
   "crc32c": "8oZBFA==",
   "etag": "COidr9KvvssCEAE="
  },
  {


   "kind": "storage#object",
   "id": "lytics-dataux-tests/tables/user/user1.csv/1457896494340000",
   "selfLink": "https://www.googleapis.com/storage/v1/b/lytics-dataux-tests/o/tables%2Fuser%2Fuser1.csv",
   "name": "tables/user/user1.csv",
   "bucket": "lytics-dataux-tests",
   "generation": "1457896494340000",
   "metageneration": "1",
   "contentType": "text/csv; charset=utf-8",
   "timeCreated": "2016-03-13T19:14:54.328Z",
   "updated": "2016-03-13T19:14:54.328Z",
   "storageClass": "STANDARD",
   "size": "299",
   "md5Hash": "p6GxtAFU3xu3q8ty852yxw==",
   "mediaLink": "https://www.googleapis.com/download/storage/v1/b/lytics-dataux-tests/o/tables%2Fuser%2Fuser1.csv?generation=1457896494340000&alt=media",
   "metadata": {
    "content_type": "text/csv; charset=utf-8"
   },
   "owner": {
    "entity": "user-00b4903a9730f58d42103a7fd40a4d0f92e371ae57112475d3993f88ccf7e8d6",
    "entityId": "00b4903a9730f58d42103a7fd40a4d0f92e371ae57112475d3993f88ccf7e8d6"
   },
   "crc32c": "1fpnNw==",
   "etag": "CKCvqNWvvssCEAE="
  }
 ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions