purity_fb_1dot12.LifecycleRulesApi

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

Method HTTP request Description
create_lifecycle_rules POST /1.12/lifecycle-rules
delete_lifecycle_rules DELETE /1.12/lifecycle-rules
list_lifecycle_rules GET /1.12/lifecycle-rules
update_lifecycle_rules PATCH /1.12/lifecycle-rules

create_lifecycle_rules

LifecycleRuleResponse create_lifecycle_rules(rule)

Create a new object lifecycle rule for a specified bucket.

Example

from purity_fb import PurityFb, rest, LifecycleRulePost, Reference

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 lifecycle rule 'myrule' for the bucket 'mybucket'.
        attr = LifecycleRulePost(bucket=Reference(name='mybucket'),
                                 rule_id='myrule',
                                 keep_previous_version_for=2*24*60*60*1000,
                                 prefix='myprefix')
        res = fb.lifecycle_rules.create_lifecycle_rules(rule=attr)
        print(res)
    except rest.ApiException as e:
        print("Exception when creating lifecycle rule: %s\n" % e)

Parameters

Name Type Description Notes
rule LifecycleRulePost

Return type

LifecycleRuleResponse

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_lifecycle_rules

delete_lifecycle_rules(bucket_ids=bucket_ids, bucket_names=bucket_names, ids=ids, names=names)

Delete an object lifecycle rule.

Example

from purity_fb import PurityFb, 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:
        # Delete the lifecycle rule named 'oldrule' from bucket 'mybucket'
        res = fb.lifecycle_rules.delete_lifecycle_rules(names=['mybucket/oldrule'])
        print(res)
        # Delete the lifecycle rule with id '00000000-0000-4000-8000-000000000000' from bucket 'mybucket'
        res = fb.lifecycle_rules.delete_lifecycle_rules(ids=['00000000-0000-4000-8000-000000000000'],
                                                        bucket_names=['mybucket'])
        print(res)
        # Delete all the lifecycle rules from bucket 'mybucket'
        res = fb.lifecycle_rules.delete_lifecycle_rules(bucket_names=['mybucket'])
        print(res)
        # Delete all the lifecycle rules from bucket with id '997082de-a66e-4d5e-aae4-33353374c764'
        res = fb.lifecycle_rules.delete_lifecycle_rules(bucket_ids=['997082de-a66e-4d5e-aae4-33353374c764'])
        print(res)
    except rest.ApiException as e:
        print('Exception when deleting lifecycle rule: %s\n' % e)

Parameters

Name Type Description Notes
bucket_ids list[str] A comma-separated list of bucket IDs. If after filtering, there is not at least one resource that matches each of the elements of `bucket_ids`, then an error is returned. This cannot be provided together with the `bucket_names` query parameter. [optional]
bucket_names list[str] A comma-separated list of bucket names. If there is not at least one resource that matches each of the elements of `bucket_names`, then an error is returned. This cannot be provided together with the `bucket_ids` query parameter. [optional]
ids list[str] A comma-separated list of resource IDs. This cannot be provided together with the name or names query parameters. [optional]
names list[str] A comma-separated list of resource names. This cannot be provided together with the ids query parameters. [optional]

Return type

void (empty response body)

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]

list_lifecycle_rules

LifecycleRuleResponse list_lifecycle_rules(bucket_ids=bucket_ids, bucket_names=bucket_names, filter=filter, ids=ids, limit=limit, names=names, sort=sort, start=start, token=token)

List object lifecycle rules.

Example

from purity_fb import PurityFb, 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:
        # List all lifecycle rules
        res = fb.lifecycle_rules.list_lifecycle_rules()
        print(res)

        # List the lifecycle rule with id '00000000-0000-4000-8000-000000000000' in bucket 'mybucket'.
        res = fb.lifecycle_rules.list_lifecycle_rules(ids=['00000000-0000-4000-8000-000000000000'],
                                                      bucket_names=['mybucket'])
        print(res)

        # List first two lifecycle rules in bucket 'mybucket'. Use default sorting.
        res = fb.lifecycle_rules.list_lifecycle_rules(limit=2, bucket_names=['mybucket'])
        print(res)

        # List the first lifecycle rule when sorting by prefix.
        res = fb.lifecycle_rules.list_lifecycle_rules(limit=1, sort='prefix')
        print(res)
    except rest.ApiException as e:
        print('Exception when listing lifecycle rules: %s\n' % e)

Parameters

Name Type Description Notes
bucket_ids list[str] A comma-separated list of bucket IDs. If after filtering, there is not at least one resource that matches each of the elements of `bucket_ids`, then an error is returned. This cannot be provided together with the `bucket_names` query parameter. [optional]
bucket_names list[str] A comma-separated list of bucket names. If there is not at least one resource that matches each of the elements of `bucket_names`, then an error is returned. This cannot be provided together with the `bucket_ids` query parameter. [optional]
filter str The filter to be used for query. [optional]
ids list[str] A comma-separated list of resource IDs. This cannot be provided together with the name or names query parameters. [optional]
limit int limit, should be >= 0 [optional]
names list[str] A comma-separated list of resource names. This cannot be provided together with the ids query parameters. [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]

Return type

LifecycleRuleResponse

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]

update_lifecycle_rules

LifecycleRuleResponse update_lifecycle_rules(rule, bucket_ids=bucket_ids, bucket_names=bucket_names, ids=ids, names=names)

Modify an object lifecycle rule.

Example

from purity_fb import PurityFb, rest, LifecycleRulePatch, Reference

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:
        attr = LifecycleRulePatch(enabled=True,
                                  keep_previous_version_for=7*24*60*60*1000,
                                  prefix='mynewprefix')
        # Modify the lifecycle rule 'myrule' for the bucket 'mybucket'.
        res = fb.lifecycle_rules.update_lifecycle_rules(names=['mybucket/myrule'], rule=attr)
        print(res)
        # Modify the lifecycle rule with id '00000000-0000-4000-8000-000000000000' for the bucket 'mybucket'.
        res = fb.lifecycle_rules.update_lifecycle_rules(ids=['00000000-0000-4000-8000-000000000000'],
                                                        bucket_names=['mybucket'],
                                                        rule=attr)
        print(res)
    except rest.ApiException as e:
        print('Exception when updating lifecycle rule: %s\n' % e)

Parameters

Name Type Description Notes
rule LifecycleRulePatch
bucket_ids list[str] A comma-separated list of bucket IDs. If after filtering, there is not at least one resource that matches each of the elements of `bucket_ids`, then an error is returned. This cannot be provided together with the `bucket_names` query parameter. [optional]
bucket_names list[str] A comma-separated list of bucket names. If there is not at least one resource that matches each of the elements of `bucket_names`, then an error is returned. This cannot be provided together with the `bucket_ids` query parameter. [optional]
ids list[str] A comma-separated list of resource IDs. This cannot be provided together with the name or names query parameters. [optional]
names list[str] A comma-separated list of resource names. This cannot be provided together with the ids query parameters. [optional]

Return type

LifecycleRuleResponse

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]