Skip to content

Latest commit

 

History

History
354 lines (283 loc) · 15.1 KB

ObjectApi.md

File metadata and controls

354 lines (283 loc) · 15.1 KB

waylay.services.storage.ObjectApi

All URIs are relative to https://api.waylay.io

Method HTTP request Description
copy_or_move PUT /storage/v1/bucket/{bucket_name}/{target_path} Copy Or Move Object
create_folder PUT /storage/v1/bucket/{bucket_name}/{object_path}/ Create Folder
list GET /storage/v1/bucket/{bucket_name}/{object_path} List Objects
remove DELETE /storage/v1/bucket/{bucket_name}/{object_path} Remove Object Or Folder

copy_or_move

copy_or_move( bucket_name: str, target_path: str, query: CopyOrMoveQuery, headers ) -> HALEntity

Copy Or Move Object

Copy or move object to new location.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.hal_entity import HALEntity
try:
    # Copy Or Move Object
    # calls `PUT /storage/v1/bucket/{bucket_name}/{target_path}`
    api_response = await waylay_client.storage.object.copy_or_move(
        'bucket_name_example', # bucket_name | path param "bucket_name"
        'target_path_example', # target_path | path param "target_path"
        # query parameters:
        query = {
            'move': False
        },
    )
    print("The response of storage.object.copy_or_move:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling storage.object.copy_or_move: %s\n" % e)

Endpoint

PUT /storage/v1/bucket/{bucket_name}/{target_path}

Parameters

Name Type API binding Description Notes
bucket_name str path parameter "bucket_name"
target_path str path parameter "target_path"
query QueryParamTypes | None URL query parameter
query['source'] (dict)
query.source (Query)
str query parameter "source"
query['move'] (dict)
query.move (Query)
bool query parameter "move" [optional] [default False]
query['store'] (dict)
query.store (Query)
str query parameter "store" [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) HALEntity HALEntity
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_folder

create_folder( bucket_name: str, object_path: str, query: CreateFolderQuery, headers ) -> BucketObject

Create Folder

Create a (virtual) folder. * (all=true) force creation of a hidden folder, having a path element that starts with a ..

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.bucket_object import BucketObject
try:
    # Create Folder
    # calls `PUT /storage/v1/bucket/{bucket_name}/{object_path}/`
    api_response = await waylay_client.storage.object.create_folder(
        'bucket_name_example', # bucket_name | path param "bucket_name"
        'object_path_example', # object_path | path param "object_path"
        # query parameters:
        query = {
            'all': False
        },
    )
    print("The response of storage.object.create_folder:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling storage.object.create_folder: %s\n" % e)

Endpoint

PUT /storage/v1/bucket/{bucket_name}/{object_path}/

Parameters

Name Type API binding Description Notes
bucket_name str path parameter "bucket_name"
object_path str path parameter "object_path"
query QueryParamTypes | None URL query parameter
query['all'] (dict)
query.all (Query)
bool query parameter "all" [optional] [default False]
query['store'] (dict)
query.store (Query)
str query parameter "store" [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) BucketObject BucketObject
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list

list( bucket_name: str, object_path: str, query: ListQuery, headers ) -> ResponseList

List Objects

List, inspect or sign objects. * list the objects of a bucket with {object_path} prefix * (recursive=true) list content recursively * (all=true) include hidden objects * (stat=true) get the meta of the object at {object_path} * (sign=[GET,PUT,POST]) fetch presigned urls to operate on {object_path} * (all=true) allow link creation for hidden objects

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.response_list import ResponseList
try:
    # List Objects
    # calls `GET /storage/v1/bucket/{bucket_name}/{object_path}`
    api_response = await waylay_client.storage.object.list(
        'bucket_name_example', # bucket_name | path param "bucket_name"
        'object_path_example', # object_path | path param "object_path"
        # query parameters:
        query = {
            'stat': False
            'recursive': True
            'all': True
            'fetch_content_type': True
            'get_as_attachment': True
            'content_length_min': 0
        },
    )
    print("The response of storage.object.list:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling storage.object.list: %s\n" % e)

Endpoint

GET /storage/v1/bucket/{bucket_name}/{object_path}

Parameters

Name Type API binding Description Notes
bucket_name str path parameter "bucket_name"
object_path str path parameter "object_path"
query QueryParamTypes | None URL query parameter
query['stat'] (dict)
query.stat (Query)
bool query parameter "stat" [optional] [default False]
query['recursive'] (dict)
query.recursive (Query)
bool query parameter "recursive" [optional]
query['all'] (dict)
query.all (Query)
bool query parameter "all" [optional]
query['start_after'] (dict)
query.start_after (Query)
str query parameter "start_after" [optional]
query['fetch_content_type'] (dict)
query.fetch_content_type (Query)
bool query parameter "fetch_content_type" [optional] [default True]
query['get_as_attachment'] (dict)
query.get_as_attachment (Query)
bool query parameter "get_as_attachment" [optional] [default True]
query['max_keys'] (dict)
query.max_keys (Query)
int query parameter "max_keys" [optional]
query['sign'] (dict)
query.sign (Query)
str query parameter "sign" [optional]
query['store'] (dict)
query.store (Query)
str query parameter "store" [optional]
query['expiry_days'] (dict)
query.expiry_days (Query)
int query parameter "expiry_days" [optional]
query['expiry_hours'] (dict)
query.expiry_hours (Query)
int query parameter "expiry_hours" [optional]
query['expiry_seconds'] (dict)
query.expiry_seconds (Query)
int query parameter "expiry_seconds" [optional]
query['content_length_min'] (dict)
query.content_length_min (Query)
int query parameter "content_length_min" [optional] [default 0]
query['content_length_max'] (dict)
query.content_length_max (Query)
int query parameter "content_length_max" [optional]
query['content_type'] (dict)
query.content_type (Query)
str query parameter "content_type" [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) ResponseList ResponseList
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

remove

remove( bucket_name: str, object_path: str, query: RemoveQuery, headers ) -> HALEntity

Remove Object Or Folder

Remove the object or folder at {object_path}. An {object_path} ending in a / requests folder deletion of an empty folder unless: * (recursive=true) forces recursive deletion of a (non-empty) folder. * (all=true) forces recursive deletion, including hidden objects.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.hal_entity import HALEntity
try:
    # Remove Object Or Folder
    # calls `DELETE /storage/v1/bucket/{bucket_name}/{object_path}`
    api_response = await waylay_client.storage.object.remove(
        'bucket_name_example', # bucket_name | path param "bucket_name"
        'object_path_example', # object_path | path param "object_path"
        # query parameters:
        query = {
            'recursive': True
            'all': True
        },
    )
    print("The response of storage.object.remove:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling storage.object.remove: %s\n" % e)

Endpoint

DELETE /storage/v1/bucket/{bucket_name}/{object_path}

Parameters

Name Type API binding Description Notes
bucket_name str path parameter "bucket_name"
object_path str path parameter "object_path"
query QueryParamTypes | None URL query parameter
query['recursive'] (dict)
query.recursive (Query)
bool query parameter "recursive" [optional]
query['all'] (dict)
query.all (Query)
bool query parameter "all" [optional]
query['start_after'] (dict)
query.start_after (Query)
str query parameter "start_after" [optional]
query['max_keys'] (dict)
query.max_keys (Query)
int query parameter "max_keys" [optional]
query['store'] (dict)
query.store (Query)
str query parameter "store" [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) HALEntity HALEntity
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]