def fs_create(name, size=None, proto='NFS', nfs_rules='*(rw,no_root_squash)', snapshot=False):
    '''

    Create a filesystem on a Pure Storage FlashBlade.

    Will return False if filesystem already exists.

    .. versionadded::  2019.2.0

    name : string
        name of filesystem (truncated to 63 characters)
    proto : string
        (Optional) Sharing protocol (NFS, CIFS or HTTP). If not specified default is NFS
    snapshot: boolean
        (Optional) Are snapshots enabled on the filesystem. Default is False
    nfs_rules : string
        (Optional) export rules for NFS. If not specified default is
        ``*(rw,no_root_squash)``. Refer to Pure Storage documentation for
        formatting rules.
    size : string
        if specified capacity of filesystem. If not specified default to 32G.
        Refer to Pure Storage documentation for formatting rules.

    CLI Example:

    .. code-block:: bash

        salt '*' purefb.fs_create foo proto=CIFS
        salt '*' purefb.fs_create foo size=10T

    '''
    if len(name) > 63:
        name = name[0:63]
    blade = _get_blade()
    print(proto)
    if _get_fs(name, blade) is None:
        if size is None:
            size = __utils__['stringutils.human_to_bytes']('32G')
        else:
            size = __utils__['stringutils.human_to_bytes'](size)
        if proto.lower() == 'nfs':
            fs_obj = FileSystem(name=name,
                                provisioned=size,
                                fast_remove_directory_enabled=True,
                                snapshot_directory_enabled=snapshot,
                                nfs=NfsRule(enabled=True, rules=nfs_rules),
                               )
        elif proto.lower() == 'cifs':
            fs_obj = FileSystem(name=name,
                                provisioned=size,
                                fast_remove_directory_enabled=True,
                                snapshot_directory_enabled=snapshot,
                                smb=ProtocolRule(enabled=True),
                               )
        elif proto.lower() == 'http':
            fs_obj = FileSystem(name=name,
                                provisioned=size,
                                fast_remove_directory_enabled=True,
                                snapshot_directory_enabled=snapshot,
                                http=ProtocolRule(enabled=True),
                               )
        else:
            return False
        try:
            blade.file_systems.create_file_systems(fs_obj)
            return True
        except rest.ApiException:
            return False
    else:
        return False
def fs_create ( name , size = None , proto = 'NFS' , nfs_rules = '*(rw,no_root_squash)' , snapshot = False ) : if len ( name ) > 63 : name = name [ 0 : 63 ] blade = _get_blade ( ) print ( proto ) if _get_fs ( name , blade ) is None : if size is None : size = __utils__ [ 'stringutils.human_to_bytes' ] ( '32G' ) else : size = __utils__ [ 'stringutils.human_to_bytes' ] ( size ) if proto . lower ( ) == 'nfs' : fs_obj = FileSystem ( name = name , provisioned = size , fast_remove_directory_enabled = True , snapshot_directory_enabled = snapshot , nfs = NfsRule ( enabled = True , rules = nfs_rules ) , ) elif proto . lower ( ) == 'cifs' : fs_obj = FileSystem ( name = name , provisioned = size , fast_remove_directory_enabled = True , snapshot_directory_enabled = snapshot , smb = ProtocolRule ( enabled = True ) , ) elif proto . lower ( ) == 'http' : fs_obj = FileSystem ( name = name , provisioned = size , fast_remove_directory_enabled = True , snapshot_directory_enabled = snapshot , http = ProtocolRule ( enabled = True ) , ) else : return False try : blade . file_systems . create_file_systems ( fs_obj ) return True except rest . ApiException : return False else : return False
Create a filesystem on a Pure Storage FlashBlade.

    Will return False if filesystem already exists.

    .. versionadded::  2019.2.0

    name : string
        name of filesystem (truncated to 63 characters)
    proto : string
        (Optional) Sharing protocol (NFS, CIFS or HTTP). If not specified default is NFS
    snapshot: boolean
        (Optional) Are snapshots enabled on the filesystem. Default is False
    nfs_rules : string
        (Optional) export rules for NFS. If not specified default is
        ``*(rw,no_root_squash)``. Refer to Pure Storage documentation for
        formatting rules.
    size : string
        if specified capacity of filesystem. If not specified default to 32G.
        Refer to Pure Storage documentation for formatting rules.

    CLI Example:

    .. code-block:: bash

        salt '*' purefb.fs_create foo proto=CIFS
        salt '*' purefb.fs_create foo size=10T