OpenSearch Service Serverless

2023/10/24 - OpenSearch Service Serverless - 6 new 1 updated api methods

Changes  This release includes the following new APIs: CreateLifecyclePolicy, UpdateLifecyclePolicy, BatchGetLifecyclePolicy, DeleteLifecyclePolicy, ListLifecyclePolicies and BatchGetEffectiveLifecyclePolicy to support the data lifecycle management feature.

CreateLifecyclePolicy (new) Link ¶

Creates a lifecyle policy to be applied to OpenSearch Serverless indexes. Lifecycle policies define the number of days or hours to retain the data on an OpenSearch Serverless index. For more information, see Creating data lifecycle policies.

See also: AWS API Documentation

Request Syntax

client.create_lifecycle_policy(
    clientToken='string',
    description='string',
    name='string',
    policy='string',
    type='retention'
)
type clientToken

string

param clientToken

A unique, case-sensitive identifier to ensure idempotency of the request.

This field is autopopulated if not provided.

type description

string

param description

A description of the lifecycle policy.

type name

string

param name

[REQUIRED]

The name of the lifecycle policy.

type policy

string

param policy

[REQUIRED]

The JSON policy document to use as the content for the lifecycle policy.

type type

string

param type

[REQUIRED]

The type of lifecycle policy.

rtype

dict

returns

Response Syntax

{
    'lifecyclePolicyDetail': {
        'createdDate': 123,
        'description': 'string',
        'lastModifiedDate': 123,
        'name': 'string',
        'policy': {...}|[...]|123|123.4|'string'|True|None,
        'policyVersion': 'string',
        'type': 'retention'
    }
}

Response Structure

  • (dict) --

    • lifecyclePolicyDetail (dict) --

      Details about the created lifecycle policy.

      • createdDate (integer) --

        The date the lifecycle policy was created.

      • description (string) --

        The description of the lifecycle policy.

      • lastModifiedDate (integer) --

        The timestamp of when the lifecycle policy was last modified.

      • name (string) --

        The name of the lifecycle policy.

      • policy (:ref:`document<document>`) --

        The JSON policy document without any whitespaces.

      • policyVersion (string) --

        The version of the lifecycle policy.

      • type (string) --

        The type of lifecycle policy.

BatchGetLifecyclePolicy (new) Link ¶

Returns one or more configured OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.

See also: AWS API Documentation

Request Syntax

client.batch_get_lifecycle_policy(
    identifiers=[
        {
            'name': 'string',
            'type': 'retention'
        },
    ]
)
type identifiers

list

param identifiers

[REQUIRED]

The unique identifiers of policy types and policy names.

  • (dict) --

    The unique identifiers of policy types and policy names.

    • name (string) -- [REQUIRED]

      The name of the lifecycle policy.

    • type (string) -- [REQUIRED]

      The type of lifecycle policy.

rtype

dict

returns

Response Syntax

{
    'lifecyclePolicyDetails': [
        {
            'createdDate': 123,
            'description': 'string',
            'lastModifiedDate': 123,
            'name': 'string',
            'policy': {...}|[...]|123|123.4|'string'|True|None,
            'policyVersion': 'string',
            'type': 'retention'
        },
    ],
    'lifecyclePolicyErrorDetails': [
        {
            'errorCode': 'string',
            'errorMessage': 'string',
            'name': 'string',
            'type': 'retention'
        },
    ]
}

Response Structure

  • (dict) --

    • lifecyclePolicyDetails (list) --

      A list of lifecycle policies matched to the input policy name and policy type.

      • (dict) --

        Details about an OpenSearch Serverless lifecycle policy.

        • createdDate (integer) --

          The date the lifecycle policy was created.

        • description (string) --

          The description of the lifecycle policy.

        • lastModifiedDate (integer) --

          The timestamp of when the lifecycle policy was last modified.

        • name (string) --

          The name of the lifecycle policy.

        • policy (:ref:`document<document>`) --

          The JSON policy document without any whitespaces.

        • policyVersion (string) --

          The version of the lifecycle policy.

        • type (string) --

          The type of lifecycle policy.

    • lifecyclePolicyErrorDetails (list) --

      A list of lifecycle policy names and policy types for which retrieval failed.

      • (dict) --

        Error information for an OpenSearch Serverless request.

        • errorCode (string) --

          The error code for the request. For example, NOT_FOUND .

        • errorMessage (string) --

          A description of the error. For example, The specified Lifecycle Policy is not found .

        • name (string) --

          The name of the lifecycle policy.

        • type (string) --

          The type of lifecycle policy.

UpdateLifecyclePolicy (new) Link ¶

Updates an OpenSearch Serverless access policy. For more information, see Updating data lifecycle policies.

See also: AWS API Documentation

Request Syntax

client.update_lifecycle_policy(
    clientToken='string',
    description='string',
    name='string',
    policy='string',
    policyVersion='string',
    type='retention'
)
type clientToken

string

param clientToken

A unique, case-sensitive identifier to ensure idempotency of the request.

This field is autopopulated if not provided.

type description

string

param description

A description of the lifecycle policy.

type name

string

param name

[REQUIRED]

The name of the policy.

type policy

string

param policy

The JSON policy document to use as the content for the lifecycle policy.

type policyVersion

string

param policyVersion

[REQUIRED]

The version of the policy being updated.

type type

string

param type

[REQUIRED]

The type of lifecycle policy.

rtype

dict

returns

Response Syntax

{
    'lifecyclePolicyDetail': {
        'createdDate': 123,
        'description': 'string',
        'lastModifiedDate': 123,
        'name': 'string',
        'policy': {...}|[...]|123|123.4|'string'|True|None,
        'policyVersion': 'string',
        'type': 'retention'
    }
}

Response Structure

  • (dict) --

    • lifecyclePolicyDetail (dict) --

      Details about the updated lifecycle policy.

      • createdDate (integer) --

        The date the lifecycle policy was created.

      • description (string) --

        The description of the lifecycle policy.

      • lastModifiedDate (integer) --

        The timestamp of when the lifecycle policy was last modified.

      • name (string) --

        The name of the lifecycle policy.

      • policy (:ref:`document<document>`) --

        The JSON policy document without any whitespaces.

      • policyVersion (string) --

        The version of the lifecycle policy.

      • type (string) --

        The type of lifecycle policy.

ListLifecyclePolicies (new) Link ¶

Returns a list of OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.

See also: AWS API Documentation

Request Syntax

client.list_lifecycle_policies(
    maxResults=123,
    nextToken='string',
    resources=[
        'string',
    ],
    type='retention'
)
type maxResults

integer

param maxResults

An optional parameter that specifies the maximum number of results to return. You can use use nextToken to get the next page of results. The default is 10.

type nextToken

string

param nextToken

If your initial ListLifecyclePolicies operation returns a nextToken , you can include the returned nextToken in subsequent ListLifecyclePolicies operations, which returns results in the next page.

type resources

list

param resources

Resource filters that policies can apply to. Currently, the only supported resource type is index .

  • (string) --

type type

string

param type

[REQUIRED]

The type of lifecycle policy.

rtype

dict

returns

Response Syntax

{
    'lifecyclePolicySummaries': [
        {
            'createdDate': 123,
            'description': 'string',
            'lastModifiedDate': 123,
            'name': 'string',
            'policyVersion': 'string',
            'type': 'retention'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • lifecyclePolicySummaries (list) --

      Details about the requested lifecycle policies.

      • (dict) --

        A summary of the lifecycle policy.

        • createdDate (integer) --

          The Epoch time when the lifecycle policy was created.

        • description (string) --

          The description of the lifecycle policy.

        • lastModifiedDate (integer) --

          The date and time when the lifecycle policy was last modified.

        • name (string) --

          The name of the lifecycle policy.

        • policyVersion (string) --

          The version of the lifecycle policy.

        • type (string) --

          The type of lifecycle policy.

    • nextToken (string) --

      When nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page.

BatchGetEffectiveLifecyclePolicy (new) Link ¶

Returns a list of successful and failed retrievals for the OpenSearch Serverless indexes. For more information, see Viewing data lifecycle policies.

See also: AWS API Documentation

Request Syntax

client.batch_get_effective_lifecycle_policy(
    resourceIdentifiers=[
        {
            'resource': 'string',
            'type': 'retention'
        },
    ]
)
type resourceIdentifiers

list

param resourceIdentifiers

[REQUIRED]

The unique identifiers of policy types and resource names.

  • (dict) --

    The unique identifiers of policy types and resource names.

    • resource (string) -- [REQUIRED]

      The name of the OpenSearch Serverless ilndex resource.

    • type (string) -- [REQUIRED]

      The type of lifecycle policy.

rtype

dict

returns

Response Syntax

{
    'effectiveLifecyclePolicyDetails': [
        {
            'noMinRetentionPeriod': True|False,
            'policyName': 'string',
            'resource': 'string',
            'resourceType': 'index',
            'retentionPeriod': 'string',
            'type': 'retention'
        },
    ],
    'effectiveLifecyclePolicyErrorDetails': [
        {
            'errorCode': 'string',
            'errorMessage': 'string',
            'resource': 'string',
            'type': 'retention'
        },
    ]
}

Response Structure

  • (dict) --

    • effectiveLifecyclePolicyDetails (list) --

      A list of lifecycle policies applied to the OpenSearch Serverless indexes.

      • (dict) --

        Error information for an OpenSearch Serverless request.

        • noMinRetentionPeriod (boolean) --

          The minimum number of index retention days set. That is an optional param that will return as true if the minimum number of days or hours is not set to a index resource.

        • policyName (string) --

          The name of the lifecycle policy.

        • resource (string) --

          The name of the OpenSearch Serverless index resource.

        • resourceType (string) --

          The type of OpenSearch Serverless resource. Currently, the only supported resource is index .

        • retentionPeriod (string) --

          The minimum number of index retention in days or hours. This is an optional parameter that will return only if it’s set.

        • type (string) --

          The type of lifecycle policy.

    • effectiveLifecyclePolicyErrorDetails (list) --

      A list of resources for which retrieval failed.

      • (dict) --

        Error information for an OpenSearch Serverless request.

        • errorCode (string) --

          The error code for the request.

        • errorMessage (string) --

          A description of the error. For example, The specified Index resource is not found .

        • resource (string) --

          The name of OpenSearch Serverless index resource.

        • type (string) --

          The type of lifecycle policy.

DeleteLifecyclePolicy (new) Link ¶

Deletes an OpenSearch Serverless lifecycle policy. For more information, see Deleting data lifecycle policies.

See also: AWS API Documentation

Request Syntax

client.delete_lifecycle_policy(
    clientToken='string',
    name='string',
    type='retention'
)
type clientToken

string

param clientToken

Unique, case-sensitive identifier to ensure idempotency of the request.

This field is autopopulated if not provided.

type name

string

param name

[REQUIRED]

The name of the policy to delete.

type type

string

param type

[REQUIRED]

The type of lifecycle policy.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetPoliciesStats (updated) Link ¶
Changes (response)
{'LifecyclePolicyStats': {'RetentionPolicyCount': 'long'}}

Returns statistical information about your OpenSearch Serverless access policies, security configurations, and security policies.

See also: AWS API Documentation

Request Syntax

client.get_policies_stats()
rtype

dict

returns

Response Syntax

{
    'AccessPolicyStats': {
        'DataPolicyCount': 123
    },
    'LifecyclePolicyStats': {
        'RetentionPolicyCount': 123
    },
    'SecurityConfigStats': {
        'SamlConfigCount': 123
    },
    'SecurityPolicyStats': {
        'EncryptionPolicyCount': 123,
        'NetworkPolicyCount': 123
    },
    'TotalPolicyCount': 123
}

Response Structure

  • (dict) --

    • AccessPolicyStats (dict) --

      Information about the data access policies in your account.

      • DataPolicyCount (integer) --

        The number of data access policies in the current account.

    • LifecyclePolicyStats (dict) --

      Information about the lifecycle policies in your account.

      • RetentionPolicyCount (integer) --

        The number of retention lifecycle policies in the current account.

    • SecurityConfigStats (dict) --

      Information about the security configurations in your account.

      • SamlConfigCount (integer) --

        The number of security configurations in the current account.

    • SecurityPolicyStats (dict) --

      Information about the security policies in your account.

      • EncryptionPolicyCount (integer) --

        The number of encryption policies in the current account.

      • NetworkPolicyCount (integer) --

        The number of network policies in the current account.

    • TotalPolicyCount (integer) --

      The total number of OpenSearch Serverless security policies and configurations in your account.