Skip to content

Latest commit

 

History

History
282 lines (210 loc) · 13.8 KB

QuotasGroupsApi.md

File metadata and controls

282 lines (210 loc) · 13.8 KB

purity_fb_1dot12.QuotasGroupsApi

All URIs are relative to https://purity_fb_server/api

Method HTTP request Description
create_group_quotas POST /1.12/quotas/groups
delete_group_quotas DELETE /1.12/quotas/groups
list_group_quotas GET /1.12/quotas/groups
update_group_quotas PATCH /1.12/quotas/groups

create_group_quotas

QuotasGroupResponse create_group_quotas(file_system_names=file_system_names, gids=gids, group_names=group_names, quota=quota)

Create a new group quota

Example

from purity_fb import PurityFb, FileSystem, QuotasGroup, rest

fb = PurityFb("10.255.9.28", version=__version__) # assume the array IP is 10.255.9.28
fb.disable_verify_ssl()
try:
    res = fb.login(API_TOKEN) # login to the array with your API_TOKEN
except rest.ApiException as e:
    print("Exception when logging in to the array: %s\n" % e)
if res:
    try:
        # Create a file system
        file_system_name = "quotaFs"
        quotaFs = FileSystem(name=file_system_name)
        # post the file system object quotaFs on the array
        res = fb.file_systems.create_file_systems(file_system=quotaFs)

        # Add a quota of 1024000 for the file system to apply to the groups with ids 998 and 999
        res = fb.quotas_groups.create_group_quotas(file_system_names=[file_system_name], gids=[998, 999],
                                                   quota=QuotasGroup(quota=1024000))
        # print the created quotas
        print(res.items)

        # Add a quota of 2048000 for the file system to apply to the groups with names group1 and group2
        res = fb.quotas_groups.create_group_quotas(file_system_names=[file_system_name],
                                                   group_names=["group1", "group2"],
                                                   quota=QuotasGroup(quota=2048000))
        # print the created quotas
        print(res.items)
    except rest.ApiException as e:
        print("Exception when creating file system or creating group quotas: %s\n" % e)

Parameters

Name Type Description Notes
file_system_names list[str] A comma-separated list of file system names. If after filtering, there is not at least one resource that matches each of the elements of names, then an error is returned. [optional]
gids list[str] A comma-separated list of group IDs. If after filtering, there is not at least one resource that matches each of the elements of group IDs, then an error is returned. This cannot be provided together with group_names query parameter. [optional]
group_names list[str] A comma-separated list of group names. If after filtering, there is not at least one resource that matches each of the elements of group names, then an error is returned. This cannot be provided together with gids query parameter. [optional]
quota QuotasGroup [optional]

Return type

QuotasGroupResponse

Authorization

AuthTokenHeader

HTTP request headers

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

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

delete_group_quotas

delete_group_quotas(names=names, file_system_names=file_system_names, gids=gids, group_names=group_names)

Delete

Example

from purity_fb import PurityFb, FileSystem, QuotasGroup, rest

fb = PurityFb("10.255.9.28", version=__version__) # assume the array IP is 10.255.9.28
fb.disable_verify_ssl()
try:
    res = fb.login(API_TOKEN) # login to the array with your API_TOKEN
except rest.ApiException as e:
    print("Exception when logging in to the array: %s\n" % e)
if res:
    try:
        # Assume you have a file system named quotaFs
        file_system_name = "quotaFs"
        quotaFs = FileSystem(name=file_system_name)

        # Delete the quotas of groups on the file system with ids 998 and 999
        fb.quotas_groups.delete_group_quotas(file_system_names=[file_system_name], gids=[998, 999])
        # Delete the quotas of groups on the file system with names group1 and group2
        fb.quotas_groups.delete_group_quotas(file_system_names=[file_system_name],
                                             group_names=["group1", "group2"])
    except rest.ApiException as e:
        print("Exception when deleting user quotas: %s\n" % e)

Parameters

Name Type Description Notes
names list[str] A comma-separated list of resource names. This cannot be provided together with the ids query parameters. [optional]
file_system_names list[str] A comma-separated list of file system names. If after filtering, there is not at least one resource that matches each of the elements of names, then an error is returned. [optional]
gids list[str] A comma-separated list of group IDs. If after filtering, there is not at least one resource that matches each of the elements of group IDs, then an error is returned. This cannot be provided together with group_names query parameter. [optional]
group_names list[str] A comma-separated list of group names. If after filtering, there is not at least one resource that matches each of the elements of group names, then an error is returned. This cannot be provided together with gids query parameter. [optional]

Return type

void (empty response body)

Authorization

AuthTokenHeader

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

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

list_group_quotas

QuotasGroupResponse list_group_quotas(names=names, filter=filter, limit=limit, sort=sort, start=start, token=token, file_system_names=file_system_names, gids=gids, group_names=group_names)

A list of quota group entries

Example

from purity_fb import PurityFb, FileSystem, QuotasGroup, rest

fb = PurityFb("10.255.9.28", version=__version__) # assume the array IP is 10.255.9.28
fb.disable_verify_ssl()
try:
    res = fb.login(API_TOKEN) # login to the array with your API_TOKEN
except rest.ApiException as e:
    print("Exception when logging in to the array: %s\n" % e)
if res:
    try:
        # Create a file system
        file_system_name = "quotaFs"
        quotaFs = FileSystem(name=file_system_name)
        # post the file system object quotaFs on the array
        res = fb.file_systems.create_file_systems(file_system=quotaFs)

        # Add a quota of 1024000 for the file system to apply to the groups with ids 998 and 999
        res = fb.quotas_groups.create_group_quotas(file_system_names=[file_system_name], gids=[998, 999],
                                                   quota=QuotasGroup(quota=1024000))

        # Add a quota of 2048000 for the file system to apply to the groups with names group1 and group2
        res = fb.quotas_groups.create_group_quotas(file_system_names=[file_system_name],
                                                   group_names=["group1", "group2"],
                                                   quota=QuotasGroup(quota=2048000))

        # List all group quotas for the file system
        res = fb.quotas_groups.list_group_quotas(file_system_names=[file_system_name])
        print(res.items)
    except rest.ApiException as e:
        print("Exception when creating file system or listing group quotas: %s\n" % e)

Parameters

Name Type Description Notes
names list[str] A comma-separated list of resource names. This cannot be provided together with the ids query parameters. [optional]
filter str The filter to be used for query. [optional]
limit int limit, should be >= 0 [optional]
sort str Sort the response by the specified fields (in descending order if '-' is appended to the field name). [optional]
start int The offset of the first resource to return from a collection. [optional]
token str An opaque token used to iterate over a collection. The token to use on the next request is returned in the `continuation_token` field of the result. [optional]
file_system_names list[str] A comma-separated list of file system names. If after filtering, there is not at least one resource that matches each of the elements of names, then an error is returned. [optional]
gids list[str] A comma-separated list of group IDs. If after filtering, there is not at least one resource that matches each of the elements of group IDs, then an error is returned. This cannot be provided together with group_names query parameter. [optional]
group_names list[str] A comma-separated list of group names. If after filtering, there is not at least one resource that matches each of the elements of group names, then an error is returned. This cannot be provided together with gids query parameter. [optional]

Return type

QuotasGroupResponse

Authorization

AuthTokenHeader

HTTP request headers

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

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

update_group_quotas

QuotasGroupResponse update_group_quotas(names=names, file_system_names=file_system_names, gids=gids, group_names=group_names, quota=quota)

Update existing group quotas

Example

from purity_fb import PurityFb, FileSystem, QuotasGroup, rest

fb = PurityFb("10.255.9.28", version=__version__) # assume the array IP is 10.255.9.28
fb.disable_verify_ssl()
try:
    res = fb.login(API_TOKEN) # login to the array with your API_TOKEN
except rest.ApiException as e:
    print("Exception when logging in to the array: %s\n" % e)
if res:
    try:
        # Create a file system named quotaFs
        file_system_name = "quotaFs"
        quotaFs = FileSystem(name=file_system_name)
        # post the file system object quotaFs on the array
        res = fb.file_systems.create_file_systems(file_system=quotaFs)

        # Add a quota of 1024000 for the file system to apply to the groups with ids 998 and 999
        res = fb.quotas_groups.create_group_quotas(file_system_names=[file_system_name],
                                                   gids=[998, 999],
                                                   quota=QuotasGroup(quota=1024000))
        # print the created quotas
        print(res.items)
        # Update the quota for the groups with with ids 998 and 999 to be 2048000
        res = fb.quotas_groups.update_group_quotas(file_system_names=[file_system_name],
                                                   gids=[998, 999],
                                                   quota=QuotasGroup(quota=2048000))
        # print the created quotas
        print(res.items)

        # Add a quota of 2048000 for the file system to apply to the groups with names group1 and group2
        res = fb.quotas_groups.create_group_quotas(file_system_names=[file_system_name],
                                                   group_names=["group1", "group2"],
                                                   quota=QuotasGroup(quota=2048000))
        # print the created quotas
        print(res.items)
        # Update the quota for the groups with names group1 and group2 to be 1024000
        res = fb.quotas_groups.update_group_quotas(file_system_names=[file_system_name],
                                                   group_names=["group1", "group2"],
                                                   quota=QuotasGroup(quota=1024000))
        # print the updated quotas
        print(res.items)
    except rest.ApiException as e:
        print("Exception when creating file system or updating group quotas: %s\n" % e)

Parameters

Name Type Description Notes
names list[str] A comma-separated list of resource names. This cannot be provided together with the ids query parameters. [optional]
file_system_names list[str] A comma-separated list of file system names. If after filtering, there is not at least one resource that matches each of the elements of names, then an error is returned. [optional]
gids list[str] A comma-separated list of group IDs. If after filtering, there is not at least one resource that matches each of the elements of group IDs, then an error is returned. This cannot be provided together with group_names query parameter. [optional]
group_names list[str] A comma-separated list of group names. If after filtering, there is not at least one resource that matches each of the elements of group names, then an error is returned. This cannot be provided together with gids query parameter. [optional]
quota QuotasGroup [optional]

Return type

QuotasGroupResponse

Authorization

AuthTokenHeader

HTTP request headers

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

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