sasctl.services.folders#

class sasctl._services.folders.Folders[source]#

Bases: Service

The Folders API provides an organizational structure for SAS and external content. It can also be used for favorites folders or a history of objects accessed. The resources that are stored in folders (members) use a URI to point back to those resources.

Methods

create_folder(name[, parent, description])

Create a new folder.

create_path(folder[, description])

Create a new folder recursively.

delete(*args, **kwargs)

Send a DELETE request.

delete_folder(item)

Delete a folder instance.

get(*args, **kwargs)

Send a GET request.

get_folder(folder[, refresh])

Return a folder instance.

get_link(obj, rel)

Get link information from a resource.

head(*args, **kwargs)

Send a HEAD request.

info()

Version and build information for the service.

is_available()

Check if the service is currently available.

list_folders([filter, start, limit])

List all folders available in the environment.

post(*args, **kwargs)

Send a POST request.

put(*args, **kwargs)

Send a PUT request.

request(verb, path[, session, format_])

Send an HTTP request with a session.

request_link(obj, rel, **kwargs)

Request a link from a resource.

update_folder(item)

Update a folder instance.

is_uuid

classmethod create_folder(name, parent=None, description=None)[source]#

Create a new folder.

Parameters:
namestr

The name of the new folder

parentstr or dict, optional

The parent folder for this folder, if any. Can be a folder name, id, or dict response from get_folder. If not specified, new folder will be created under root folder.

descriptionstr, optional

A description of the folder

Returns:
RestObj

Details of newly-created folder

classmethod create_path(folder, description=None)[source]#

Create a new folder recursively.

Parameters:
folderstr

The folder to be created including the path.

description: str, optional

A description of the folder

Returns:
RestObj

Details of newly-created folder

classmethod delete_folder(item)#

Delete a folder instance.

Parameters:
item
Returns:
None
classmethod get_folder(folder, refresh=False)[source]#

Return a folder instance.

Parameters:
folderstr or dict
May be one of:
  • folder name

  • folder ID

  • folder path

  • folder delegate string

  • dictionary representation of the folder

refreshbool, optional

Obtain an updated copy of the folder.

Returns:
RestObj or None

A dictionary containing the folder attributes or None.

Notes

If folder is a complete representation of the folder it will be returned unless refresh is set. This prevents unnecessary REST calls when data is already available on the client.

Examples

The following four examples are all functionally equivalent.

>>> get_folder("Public")
{"name": "Public", "id": "4a737209-5662"}
>>> get_folder("/Public")
{"name": "Public", "id": "4a737209-5662"}
>>> get_folder("@public")
{"name": "Public", "id": "4a737209-5662"}
>>> get_folder("@public")
{"name": "Public", "id": "4a737209-5662"}
>>> get_folder("4a737209-5662")
{"name": "Public", "id": "4a737209-5662"}

The full folder path can also be specified.

>>> get_folder("/Public/Demo")
{"name": "Demo", "id": "148081bf-1c86"}

Special folders can be identified using a delegate string. Currently supported are: @myFolder, @appDataFolder, @myHistory, @myFavorites, and @public.

>>> get_folder("@myFolder")
{"name": "My Folder", "id": "71687cd2-db4b"}
classmethod list_folders(filter=None, start=None, limit=None, **kwargs)#

List all folders available in the environment.

Parameters:
filterstr, optional
startint, optional

Zero-based index of the first item to return. Defaults to 0.

limitint, optional

The maximum number of items to return. Defaults to 20.

Returns:
list

A list of dictionaries containing the folders.

Notes

See the filtering reference for details on the filter parameter.

classmethod update_folder(item)#

Update a folder instance.

Parameters:
itemdict
Returns:
None