oracle.oci.oci_object_storage_object_lifecycle_policy (5.0.0) — module

Manage an ObjectLifecyclePolicy resource in Oracle Cloud Infrastructure

| "added in version" 2.9.0 of oracle.oci"

Authors: Oracle (@oracle)

preview | supported by community

Install collection

Install with ansible-galaxy collection install oracle.oci:==5.0.0


Add to requirements.yml

  collections:
    - name: oracle.oci
      version: 5.0.0

Description

This module allows the user to update and delete an ObjectLifecyclePolicy resource in Oracle Cloud Infrastructure


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update object_lifecycle_policy
  oci_object_storage_object_lifecycle_policy:
    # required
    namespace_name: namespace_name_example
    bucket_name: bucket_name_example

    # optional
    items:
    - # required
      name: name_example
      action: action_example
      time_amount: 56
      time_unit: DAYS
      is_enabled: true

      # optional
      target: target_example
      object_name_filter:
        # optional
        inclusion_prefixes: [ "inclusion_prefixes_example" ]
        inclusion_patterns: [ "inclusion_patterns_example" ]
        exclusion_patterns: [ "exclusion_patterns_example" ]
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete object_lifecycle_policy
  oci_object_storage_object_lifecycle_policy:
    # required
    namespace_name: namespace_name_example
    bucket_name: bucket_name_example
    state: absent

Inputs

    
items:
    description:
    - The bucket's set of lifecycle policy rules.
    - This parameter is updatable.
    elements: dict
    suboptions:
      action:
        description:
        - The action of the object lifecycle policy rule. Rules using the action 'ARCHIVE'
          move objects from Standard and InfrequentAccess storage tiers into the L(Archive
          storage tier,https://docs.cloud.oracle.com/Content/Archive/Concepts/archivestorageoverview.htm).
          Rules using the action 'INFREQUENT_ACCESS' move objects from Standard storage
          tier into the Infrequent Access Storage tier. Objects that are already in InfrequentAccess
          tier or in Archive tier are left untouched. Rules using the action 'DELETE'
          permanently delete objects from buckets. Rules using 'ABORT' abort the uncommitted
          multipart-uploads and permanently delete their parts from buckets.
        - This parameter is updatable.
        required: true
        type: str
      is_enabled:
        description:
        - A Boolean that determines whether this rule is currently enabled.
        - This parameter is updatable.
        required: true
        type: bool
      name:
        description:
        - The name of the lifecycle rule to be applied.
        - This parameter is updatable.
        required: true
        type: str
      object_name_filter:
        description:
        - ''
        suboptions:
          exclusion_patterns:
            description:
            - An array of glob patterns to match the object names to exclude. An empty
              array is ignored. Exclusion patterns take precedence over inclusion patterns.
              A Glob pattern is a sequence of characters to match text. Any character
              that appears in the pattern, other than the special pattern characters described
              below, matches itself. Glob patterns must be between 1 and 1024 characters.
            - '   The special pattern characters have the following meanings:'
            - '   \           Escapes the following character *           Matches any
              string of characters. ?           Matches any single character . [...]       Matches
              a group of characters. A group of characters can be: A set of characters,
              for example: [Zafg9@]. This matches any character in the brackets. A range
              of characters, for example: [a-z]. This matches any character in the range.
              [a-f] is equivalent to [abcdef]. For character ranges only the CHARACTER-CHARACTER
              pattern is supported. [ab-yz] is not valid [a-mn-z] is not valid Character
              ranges can not start with ^ or : To include a ''-'' in the range, make it
              the first or last character.'
            - This parameter is updatable.
            elements: str
            type: list
          inclusion_patterns:
            description:
            - An array of glob patterns to match the object names to include. An empty
              array includes all objects in the bucket. Exclusion patterns take precedence
              over inclusion patterns. A Glob pattern is a sequence of characters to match
              text. Any character that appears in the pattern, other than the special
              pattern characters described below, matches itself. Glob patterns must be
              between 1 and 1024 characters.
            - '   The special pattern characters have the following meanings:'
            - '   \           Escapes the following character *           Matches any
              string of characters. ?           Matches any single character . [...]       Matches
              a group of characters. A group of characters can be: A set of characters,
              for example: [Zafg9@]. This matches any character in the brackets. A range
              of characters, for example: [a-z]. This matches any character in the range.
              [a-f] is equivalent to [abcdef]. For character ranges only the CHARACTER-CHARACTER
              pattern is supported. [ab-yz] is not valid [a-mn-z] is not valid Character
              ranges can not start with ^ or : To include a ''-'' in the range, make it
              the first or last character.'
            - This parameter is updatable.
            elements: str
            type: list
          inclusion_prefixes:
            description:
            - An array of object name prefixes that the rule will apply to. An empty array
              means to include all objects.
            - This parameter is updatable.
            elements: str
            type: list
        type: dict
      target:
        description:
        - The target of the object lifecycle policy rule. The values of target can be
          either "objects", "multipart-uploads" or "previous-object-versions". This field
          when declared as "objects" is used to specify ARCHIVE, INFREQUENT_ACCESS or
          DELETE rule for objects. This field when declared as "previous-object-versions"
          is used to specify ARCHIVE, INFREQUENT_ACCESS or DELETE rule for previous versions
          of existing objects. This field when declared as "multipart-uploads" is used
          to specify the ABORT (only) rule for uncommitted multipart-uploads.
        - This parameter is updatable.
        type: str
      time_amount:
        description:
        - Specifies the age of objects to apply the rule to. The timeAmount is interpreted
          in units defined by the timeUnit parameter, and is calculated in relation to
          each object's Last-Modified time.
        - This parameter is updatable.
        required: true
        type: int
      time_unit:
        choices:
        - DAYS
        - YEARS
        description:
        - The unit that should be used to interpret timeAmount.  Days are defined as starting
          and ending at midnight UTC. Years are defined as 365.2425 days long and likewise
          round up to the next midnight UTC.
        - This parameter is updatable.
        required: true
        type: str
    type: list

state:
    choices:
    - present
    - absent
    default: present
    description:
    - The state of the ObjectLifecyclePolicy.
    - Use I(state=present) to update an existing an ObjectLifecyclePolicy.
    - Use I(state=absent) to delete an ObjectLifecyclePolicy.
    required: false
    type: str

region:
    description:
    - The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set,
      then the value of the OCI_REGION variable, if any, is used. This option is required
      if the region is not specified through a configuration file (See C(config_file_location)).
      Please refer to U(https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm)
      for more information on OCI regions.
    type: str

tenancy:
    description:
    - OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if
      any, is used. This option is required if the tenancy OCID is not specified through
      a configuration file (See C(config_file_location)). To get the tenancy OCID, please
      refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm)
    type: str

api_user:
    description:
    - The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the
      value of the OCI_USER_ID environment variable, if any, is used. This option is required
      if the user is not specified through a configuration file (See C(config_file_location)).
      To get the user's OCID, please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
    type: str

auth_type:
    choices:
    - api_key
    - instance_principal
    - instance_obo_user
    - resource_principal
    - security_token
    default: api_key
    description:
    - The type of authentication to use for making API requests. By default C(auth_type="api_key")
      based authentication is performed and the API key (see I(api_user_key_file)) in
      your config file will be used. If this 'auth_type' module option is not specified,
      the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use C(auth_type="instance_principal")
      to use instance principal based authentication when running ansible playbooks within
      an OCI compute instance.
    type: str

bucket_name:
    description:
    - 'The name of the bucket. Avoid entering confidential information. Example: `my-new-bucket1`'
    required: true
    type: str

cert_bundle:
    description:
    - The full path to a CA certificate bundle to be used for SSL verification. This will
      override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE
      variable, if any, is used.
    type: str

auth_purpose:
    choices:
    - service_principal
    description:
    - The auth purpose which can be used in conjunction with 'auth_type=instance_principal'.
      The default auth_purpose for instance_principal is None.
    type: str

namespace_name:
    description:
    - The Object Storage namespace used for the request.
    required: true
    type: str

api_user_key_file:
    description:
    - Full path and filename of the private key (in PEM format). If not set, then the
      value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required
      if the private key is not specified through a configuration file (See C(config_file_location)).
      If the key is encrypted with a pass-phrase, the C(api_user_key_pass_phrase) option
      must also be provided.
    type: str

config_profile_name:
    description:
    - The profile to load from the config file referenced by C(config_file_location).
      If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any,
      is used. Otherwise, defaults to the "DEFAULT" profile in C(config_file_location).
    type: str

api_user_fingerprint:
    description:
    - Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT
      environment variable, if any, is used. This option is required if the key fingerprint
      is not specified through a configuration file (See C(config_file_location)). To
      get the key pair's fingerprint value please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
    type: str

config_file_location:
    description:
    - Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment
      variable, if any, is used. Otherwise, defaults to ~/.oci/config.
    type: str

api_user_key_pass_phrase:
    description:
    - Passphrase used by the key referenced in C(api_user_key_file), if it is encrypted.
      If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is
      used. This option is required if the key passphrase is not specified through a configuration
      file (See C(config_file_location)).
    type: str

realm_specific_endpoint_template_enabled:
    description:
    - Enable/Disable realm specific endpoint template for service client. By Default,
      realm specific endpoint template is disabled. If not set, then the value of the
      OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used.
    type: bool

Outputs

object_lifecycle_policy:
  contains:
    items:
      contains:
        action:
          description:
          - The action of the object lifecycle policy rule. Rules using the action
            'ARCHIVE' move objects from Standard and InfrequentAccess storage tiers
            into the L(Archive storage tier,https://docs.cloud.oracle.com/Content/Archive/Concepts/archivestorageoverview.htm).
            Rules using the action 'INFREQUENT_ACCESS' move objects from Standard
            storage tier into the Infrequent Access Storage tier. Objects that are
            already in InfrequentAccess tier or in Archive tier are left untouched.
            Rules using the action 'DELETE' permanently delete objects from buckets.
            Rules using 'ABORT' abort the uncommitted multipart-uploads and permanently
            delete their parts from buckets.
          returned: on success
          sample: action_example
          type: str
        is_enabled:
          description:
          - A Boolean that determines whether this rule is currently enabled.
          returned: on success
          sample: true
          type: bool
        name:
          description:
          - The name of the lifecycle rule to be applied.
          returned: on success
          sample: name_example
          type: str
        object_name_filter:
          contains:
            exclusion_patterns:
              description:
              - An array of glob patterns to match the object names to exclude. An
                empty array is ignored. Exclusion patterns take precedence over inclusion
                patterns. A Glob pattern is a sequence of characters to match text.
                Any character that appears in the pattern, other than the special
                pattern characters described below, matches itself. Glob patterns
                must be between 1 and 1024 characters.
              - '   The special pattern characters have the following meanings:'
              - '   \           Escapes the following character *           Matches
                any string of characters. ?           Matches any single character
                . [...]       Matches a group of characters. A group of characters
                can be: A set of characters, for example: [Zafg9@]. This matches any
                character in the brackets. A range of characters, for example: [a-z].
                This matches any character in the range. [a-f] is equivalent to [abcdef].
                For character ranges only the CHARACTER-CHARACTER pattern is supported.
                [ab-yz] is not valid [a-mn-z] is not valid Character ranges can not
                start with ^ or : To include a ''-'' in the range, make it the first
                or last character.'
              returned: on success
              sample: []
              type: list
            inclusion_patterns:
              description:
              - An array of glob patterns to match the object names to include. An
                empty array includes all objects in the bucket. Exclusion patterns
                take precedence over inclusion patterns. A Glob pattern is a sequence
                of characters to match text. Any character that appears in the pattern,
                other than the special pattern characters described below, matches
                itself. Glob patterns must be between 1 and 1024 characters.
              - '   The special pattern characters have the following meanings:'
              - '   \           Escapes the following character *           Matches
                any string of characters. ?           Matches any single character
                . [...]       Matches a group of characters. A group of characters
                can be: A set of characters, for example: [Zafg9@]. This matches any
                character in the brackets. A range of characters, for example: [a-z].
                This matches any character in the range. [a-f] is equivalent to [abcdef].
                For character ranges only the CHARACTER-CHARACTER pattern is supported.
                [ab-yz] is not valid [a-mn-z] is not valid Character ranges can not
                start with ^ or : To include a ''-'' in the range, make it the first
                or last character.'
              returned: on success
              sample: []
              type: list
            inclusion_prefixes:
              description:
              - An array of object name prefixes that the rule will apply to. An empty
                array means to include all objects.
              returned: on success
              sample: []
              type: list
          description:
          - ''
          returned: on success
          type: complex
        target:
          description:
          - The target of the object lifecycle policy rule. The values of target can
            be either "objects", "multipart-uploads" or "previous-object-versions".
            This field when declared as "objects" is used to specify ARCHIVE, INFREQUENT_ACCESS
            or DELETE rule for objects. This field when declared as "previous-object-versions"
            is used to specify ARCHIVE, INFREQUENT_ACCESS or DELETE rule for previous
            versions of existing objects. This field when declared as "multipart-uploads"
            is used to specify the ABORT (only) rule for uncommitted multipart-uploads.
          returned: on success
          sample: target_example
          type: str
        time_amount:
          description:
          - Specifies the age of objects to apply the rule to. The timeAmount is interpreted
            in units defined by the timeUnit parameter, and is calculated in relation
            to each object's Last-Modified time.
          returned: on success
          sample: 56
          type: int
        time_unit:
          description:
          - The unit that should be used to interpret timeAmount.  Days are defined
            as starting and ending at midnight UTC. Years are defined as 365.2425
            days long and likewise round up to the next midnight UTC.
          returned: on success
          sample: DAYS
          type: str
      description:
      - The live lifecycle policy on the bucket.
      - For an example of this value, see the L(PutObjectLifecyclePolicy API documentation,https://docs.cloud.oracle.com/iaas/api/#/en/objectstorage/20160918/ObjectLifecyclePolicy/PutObjectLifecyclePolicy).
      returned: on success
      type: complex
    time_created:
      description:
      - The date and time the object lifecycle policy was created, as described in
        L(RFC 3339,https://tools.ietf.org/html/rfc3339).
      returned: on success
      sample: '2013-10-20T19:20:30+01:00'
      type: str
  description:
  - Details of the ObjectLifecyclePolicy resource acted upon by the current operation
  returned: on success
  sample:
    items:
    - action: action_example
      is_enabled: true
      name: name_example
      object_name_filter:
        exclusion_patterns: []
        inclusion_patterns: []
        inclusion_prefixes: []
      target: target_example
      time_amount: 56
      time_unit: DAYS
    time_created: '2013-10-20T19:20:30+01:00'
  type: complex