com.aliyun.oss.model

## 类 ListVersionsRequest

- java.lang.Object
- - com.aliyun.oss.model.WebServiceRequest
  - - com.aliyun.oss.model.GenericRequest
    - - com.aliyun.oss.model.ListVersionsRequest

-     public class ListVersionsRequest
      extends GenericRequest

  Provides options for returning a list of summary information about the versions in a specified bucket.

  Returned version summaries are ordered first by key and then by version. Keys are sorted lexicographically (i.e. alphabetically from a-Z) and versions are sorted from the most recent to the least recent. Versions with data and versions with delete markers are included in the results.

  Buckets can contain a virtually unlimited number of keys, and the complete results of a list query can be extremely large. To manage large result sets, OSS uses pagination to split them into multiple responses. Always check the `ObjectListing.isTruncated()` method to see if the returned listing is complete, or if callers need to make additional calls to get more results.

  Objects created before versioning was enabled or when versioning is suspended will be given the default `null` version ID (see `Constants#NULL_VERSION_ID`). Note that the `null` version ID is a valid version ID and is not the same as not having a version ID.

  Calling `setDelimiter(String)` sets the delimiter, allowing groups of keys that share the delimiter-terminated prefix to be included in the returned listing. This allows applications to organize and browse their keys hierarchically, similar to how a file system organizes files into directories. These common prefixes can be retrieved through the `VersionListing.getCommonPrefixes()` method.

  For example, consider a bucket that contains the following keys:

  - "foo/bar/baz"
  - "foo/bar/bash"
  - "foo/bar/bang"
  - "foo/boo"
  If calling `listVersions` with a prefix value of "foo/" and a delimiter value of "/" on this bucket, an `VersionListing` is returned that contains one key ("foo/boo") and one entry in the common prefixes list ("foo/bar/"). To see deeper into the virtual hierarchy, make another call to `listVersions` setting the prefix parameter to any interesting common prefix to list the individual keys under that prefix.

  The total number of keys in a bucket doesn't substantially affect list performance, nor does the presence or absence of additional request parameters.

  For more information about enabling versioning for a bucket, see `OSS#setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest)`.

- - ### 字段概要

    - ### 从类继承的字段 com.aliyun.oss.model.WebServiceRequest

      `NOOP`

  - ### 构造器概要

    构造器
    构造器和说明
    `ListVersionsRequest()` Constructs a new `ListVersionsRequest` object.
    `ListVersionsRequest(String bucketName, String prefix, String keyMarker, String versionIdMarker, String delimiter, Integer maxResults)` Constructs a new `ListVersionsRequest` object and initializes all required and optional fields.

  - ### 方法概要

    方法
    限定符和类型 | 方法和说明
    --- | ---
    `String` | `getDelimiter()` Gets the optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
    `String` | `getEncodingType()` Gets the optional `encodingType` parameter indicating the encoding method to be applied on the response.
    `String` | `getKeyMarker()` Gets the optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
    `Integer` | `getMaxResults()` Gets the optional `maxResults` parameter indicating the maximum number of results to include in the response.
    `String` | `getPrefix()` Gets the optional prefix parameter restricting the response to keys that begin with the specified prefix.
    `String` | `getVersionIdMarker()` Gets the optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
    `void` | `setDelimiter(String delimiter)` Sets the optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
    `void` | `setEncodingType(String encodingType)` Sets the optional `encodingType` parameter indicating the encoding method to be applied on the response.
    `void` | `setKeyMarker(String keyMarker)` Sets the optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
    `void` | `setMaxResults(Integer maxResults)` Sets the optional `maxResults` parameter indicating the maximum number of results to include in the response.
    `void` | `setPrefix(String prefix)` Sets the optional prefix parameter restricting the response to keys that begin with the specified prefix.
    `void` | `setVersionIdMarker(String versionIdMarker)` Sets the optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
    `ListVersionsRequest` | `withBucketName(String bucketName)` Sets the name of the OSS bucket whose versions are to be listed.
    `ListVersionsRequest` | `withDelimiter(String delimiter)` Sets the optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
    `ListVersionsRequest` | `withEncodingType(String encodingType)` Sets the optional `encodingType` parameter indicating the encoding method to be applied on the response.
    `ListVersionsRequest` | `withKeyMarker(String keyMarker)` Sets the optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
    `ListVersionsRequest` | `withMaxResults(Integer maxResults)` Sets the optional `maxResults` parameter indicating the maximum number of results to include in the response.
    `ListVersionsRequest` | `withPrefix(String prefix)` Sets the optional prefix parameter restricting the response to keys that begin with the specified prefix.
    `ListVersionsRequest` | `withVersionIdMarker(String versionIdMarker)` Sets the optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.

    - ### 从类继承的方法 com.aliyun.oss.model.GenericRequest

      `getBucketName, getKey, getRequestPayer, getVersionId, setBucketName, setKey, setRequestPayer, setVersionId, withKey, withRequestPayer, withVersionId`

    - ### 从类继承的方法 com.aliyun.oss.model.WebServiceRequest

      `addAdditionalHeaderName, addHeader, addParameter, getAdditionalHeaderNames, getHeaders, getParameters, getProgressListener, isLogEnabled, setAdditionalHeaderNames, setHeaders, setLogEnabled, setParameters, setProgressListener, withProgressListener`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### ListVersionsRequest

          public ListVersionsRequest()

      Constructs a new `ListVersionsRequest` object. The caller must populate the fields before the request is executed.
      另请参阅:
        `ListVersionsRequest(String, String, String, String, String, Integer)`

    - #### ListVersionsRequest

          public ListVersionsRequest(String bucketName,
                             String prefix,
                             String keyMarker,
                             String versionIdMarker,
                             String delimiter,
                             Integer maxResults)

      Constructs a new `ListVersionsRequest` object and initializes all required and optional fields.
      参数:
        `bucketName` - The name of the bucket whose versions are to be listed.
        `prefix` - The prefix restricting what keys will be listed.
        `keyMarker` - The key marker indicating where results should begin.
        `versionIdMarker` - The version ID marker indicating where results should begin.
        `delimiter` - The delimiter for condensing common prefixes in returned results.
        `maxResults` - The maximum number of results to return.
      另请参阅:
        `ListVersionsRequest()`

  - ### 方法详细资料

    - #### withBucketName

          public ListVersionsRequest withBucketName(String bucketName)

      Sets the name of the OSS bucket whose versions are to be listed. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      覆盖:
        `withBucketName` 在类中 `GenericRequest`
      参数:
        `bucketName` - The name of the OSS bucket whose versions are to be listed.
      返回:
        This `ListVersionsRequest`, enabling additional method calls to be chained together.
      另请参阅:
        `GenericRequest.getBucketName()`, `GenericRequest.setBucketName(String)`

    - #### getPrefix

          public String getPrefix()

      Gets the optional prefix parameter restricting the response to keys that begin with the specified prefix. Use prefixes to separate a bucket into different sets of keys, similar to how a file system organizes files into directories.
      返回:
        The optional prefix parameter restricting the response to keys that begin with the specified prefix.
      另请参阅:
        `setPrefix(String)`, `withPrefix(String)`

    - #### setPrefix

          public void setPrefix(String prefix)

      Sets the optional prefix parameter restricting the response to keys that begin with the specified prefix.
      参数:
        `prefix` - The optional prefix parameter restricting the response to keys that begin with the specified prefix.
      另请参阅:
        `getPrefix()`, `withPrefix(String)`

    - #### withPrefix

          public ListVersionsRequest withPrefix(String prefix)

      Sets the optional prefix parameter restricting the response to keys that begin with the specified prefix. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      参数:
        `prefix` - The optional prefix parameter restricting the response to keys that begin with the specified prefix.
      返回:
        This `ListVersionsRequest`, enabling additional method calls to be chained together.
      另请参阅:
        `getPrefix()`, `setPrefix(String)`

    - #### getKeyMarker

          public String getKeyMarker()

      Gets the optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results. Results are always ordered first lexicographically (i.e. alphabetically) and then from most recent version to least recent version.

      If a `keyMarker` is used without a version ID marker, results begin immediately after that key's last version. When a `keyMarker` is used with a version ID marker, results begin immediately after the version with the specified key and version ID.

      返回:
        The optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      另请参阅:
        `setKeyMarker(String)`, `withKeyMarker(String)`

    - #### setKeyMarker

          public void setKeyMarker(String keyMarker)

      Sets the optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      参数:
        `keyMarker` - The optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      另请参阅:
        `getKeyMarker()`, `withKeyMarker(String)`

    - #### withKeyMarker

          public ListVersionsRequest withKeyMarker(String keyMarker)

      Sets the optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      参数:
        `keyMarker` - The optional `keyMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      返回:
        This `ListVersionsRequest`, enabling additional method calls to be chained together.
      另请参阅:
        `getKeyMarker()`, `setKeyMarker(String)`

    - #### getVersionIdMarker

          public String getVersionIdMarker()

      Gets the optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results. Results are always ordered first lexicographically (i.e. alphabetically) and then from most recent version to least recent version.

      A key marker must be specified when specifying a `versionIdMarker`. Results begin immediately after the version with the specified key and version ID.

      返回:
        The optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      另请参阅:
        `setVersionIdMarker(String)`, `withVersionIdMarker(String)`

    - #### setVersionIdMarker

          public void setVersionIdMarker(String versionIdMarker)

      Sets the optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      参数:
        `versionIdMarker` - The optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      另请参阅:
        `getVersionIdMarker()`, `withVersionIdMarker(String)`

    - #### withVersionIdMarker

          public ListVersionsRequest withVersionIdMarker(String versionIdMarker)

      Sets the optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      参数:
        `versionIdMarker` - The optional `versionIdMarker` parameter indicating where in the sorted list of all versions in the specified bucket to begin returning results.
      返回:
        This `ListVersionsRequest`, enabling additional method calls to be chained together.
      另请参阅:
        `getVersionIdMarker()`, `setVersionIdMarker(String)`

    - #### getDelimiter

          public String getDelimiter()

      Gets the optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list. These combined keys are not returned elsewhere in the response.

      The most commonly used delimiter is "/", which simulates a hierarchical organization similar to a file system directory structure.

      返回:
        The optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
      另请参阅:
        `setDelimiter(String)`, `withDelimiter(String)`

    - #### setDelimiter

          public void setDelimiter(String delimiter)

      Sets the optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
      参数:
        `delimiter` - The optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
      另请参阅:
        `getDelimiter()`, `withDelimiter(String)`

    - #### withDelimiter

          public ListVersionsRequest withDelimiter(String delimiter)

      Sets the optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      参数:
        `delimiter` - The optional delimiter parameter that causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element in the `VersionListing.getCommonPrefixes()` list.
      返回:
        This `ListVersionsRequest`, enabling additional method calls to be chained together.
      另请参阅:
        `getDelimiter()`, `setDelimiter(String)`

    - #### getMaxResults

          public Integer getMaxResults()

      Gets the optional `maxResults` parameter indicating the maximum number of results to include in the response. OSS might return fewer than this, but will never return more. Even if `maxResults` is not specified, OSS will limit the number of results in the response.
      返回:
        The optional `maxResults` parameter indicating the maximum number of results
      另请参阅:
        `setMaxResults(Integer)`, `withMaxResults(Integer)`

    - #### setMaxResults

          public void setMaxResults(Integer maxResults)

      Sets the optional `maxResults` parameter indicating the maximum number of results to include in the response.
      参数:
        `maxResults` - The optional `maxResults` parameter indicating the maximum number of results to include in the response.
      另请参阅:
        `getMaxResults()`, `withMaxResults(Integer)`

    - #### withMaxResults

          public ListVersionsRequest withMaxResults(Integer maxResults)

      Sets the optional `maxResults` parameter indicating the maximum number of results to include in the response. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      参数:
        `maxResults` - The optional `maxResults` parameter indicating the maximum number of results to include in the response.
      返回:
        This `ListVersionsRequest`, enabling additional method calls to be chained together.
      另请参阅:
        `getMaxResults()`, `setMaxResults(Integer)`

    - #### getEncodingType

          public String getEncodingType()

      Gets the optional `encodingType` parameter indicating the encoding method to be applied on the response.
      返回:
        The encoding method to be applied on the response.

    - #### setEncodingType

          public void setEncodingType(String encodingType)

      Sets the optional `encodingType` parameter indicating the encoding method to be applied on the response. An object key can contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that OSS encode the keys in the response.
      参数:
        `encodingType` - The encoding method to be applied on the response. Valid values: null (not encoded) or "url".

    - #### withEncodingType

          public ListVersionsRequest withEncodingType(String encodingType)

      Sets the optional `encodingType` parameter indicating the encoding method to be applied on the response. An object key can contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that OSS encode the keys in the response. Returns this `ListVersionsRequest`, enabling additional method calls to be chained together.
      参数:
        `encodingType` - The encoding method to be applied on the response. Valid values: null (not encoded) or "url".

Copyright © 2020. All Rights Reserved.