Returns a list of Fragment objects from the specified stream and timestamp range within the archived data.
Listing fragments is eventually consistent. This means that even if the producer receives an acknowledgment that a fragment is persisted, the result might not be returned immediately from a request to ListFragments. However, results are typically available in less than one second.
You must first call the GetDataEndpoint API to get an endpoint. Then send the ListFragments requests to this endpoint using the --endpoint-url parameter.
If an error is thrown after invoking a Kinesis Video Streams archived media API, in addition to the HTTP status code and the response body, it includes the following pieces of information:
-
x-amz-ErrorType HTTP header – contains a more specific error type in addition to what the HTTP status code provides.
-
x-amz-RequestId HTTP header – if you want to report an issue to Amazon Web Services, the support team can better diagnose the problem if given the Request Id.
Both the HTTP status code and the ErrorType header can be utilized to make programmatic decisions about whether errors are retry-able and under what conditions, as well as provide information on what actions the client programmer might need to take in order to successfully try again.
For more information, see the Errors section at the bottom of this topic, as well as Common Errors.
Parameters:
-
stream_name
(Optional[StreamName], default:
None
)
–
The name of the stream from which to retrieve a fragment list. Specify either this parameter or the StreamARN parameter.
-
stream_arn
(Optional[ResourceARN], default:
None
)
–
The Amazon Resource Name (ARN) of the stream from which to retrieve a fragment list. Specify either this parameter or the StreamName parameter.
-
max_results
(Optional[ListFragmentsMaxResults], default:
None
)
–
The total number of fragments to return. If the total number of fragments available is more than the value specified in max-results, then a ListFragmentsOutput$NextToken is provided in the output that you can use to resume pagination.
-
next_token
(Optional[NextToken], default:
None
)
–
-
fragment_selector
(Optional[FragmentSelector], default:
None
)
–
Describes the timestamp range and timestamp origin for the range of fragments to return.
This is only required when the NextToken isn't passed in the API.
Raises:
-
ClientLimitExceededException
–
Kinesis Video Streams has throttled the request because you have exceeded a limit. Try making the call later. For information about limits, see Kinesis Video Streams Limits.
-
InvalidArgumentException
–
A specified parameter exceeds its restrictions, is not supported, or can't be used.
-
NotAuthorizedException
–
Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token has expired.
-
ResourceNotFoundException
–
GetImages will throw this error when Kinesis Video Streams can't find the stream that you specified.
GetHLSStreamingSessionURL and GetDASHStreamingSessionURL throw this error if a session with a PlaybackMode of ON_DEMAND or LIVE_REPLAYis requested for a stream that has no fragments within the requested time range, or if a session with a PlaybackMode of LIVE is requested for a stream that has no fragments within the last 30 seconds.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_kinesis_video_archived_media/_services/kinesis_video_archived_media.py
| def list_fragments(
self,
*,
config_overrides: Optional[KinesisVideoArchivedMediaClientConfig] = None,
stream_name: Optional[
"capo_kinesis_video_archived_media.types.stream_name.StreamName"
] = None,
stream_arn: Optional[
"capo_kinesis_video_archived_media.types.resource_arn.ResourceARN"
] = None,
max_results: Optional[
"capo_kinesis_video_archived_media.types.list_fragments_max_results.ListFragmentsMaxResults"
] = None,
next_token: Optional[
"capo_kinesis_video_archived_media.types.next_token.NextToken"
] = None,
fragment_selector: Optional[
"capo_kinesis_video_archived_media.types.fragment_selector.FragmentSelector"
] = None,
) -> "capo_kinesis_video_archived_media.types.list_fragments_output.ListFragmentsOutput":
"""<p>Returns a list of <a>Fragment</a> objects from the specified stream and timestamp range within the archived data.</p> <p>Listing fragments is eventually consistent. This means that even if the producer receives an acknowledgment that a fragment is persisted, the result might not be returned immediately from a request to <code>ListFragments</code>. However, results are typically available in less than one second.</p> <note> <p>You must first call the <code>GetDataEndpoint</code> API to get an endpoint. Then send the <code>ListFragments</code> requests to this endpoint using the <a href="https://docs.aws.amazon.com/cli/latest/reference/">--endpoint-url parameter</a>. </p> </note> <important> <p>If an error is thrown after invoking a Kinesis Video Streams archived media API, in addition to the HTTP status code and the response body, it includes the following pieces of information: </p> <ul> <li> <p> <code>x-amz-ErrorType</code> HTTP header – contains a more specific error type in addition to what the HTTP status code provides. </p> </li> <li> <p> <code>x-amz-RequestId</code> HTTP header – if you want to report an issue to Amazon Web Services, the support team can better diagnose the problem if given the Request Id.</p> </li> </ul> <p>Both the HTTP status code and the ErrorType header can be utilized to make programmatic decisions about whether errors are retry-able and under what conditions, as well as provide information on what actions the client programmer might need to take in order to successfully try again.</p> <p>For more information, see the <b>Errors</b> section at the bottom of this topic, as well as <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/CommonErrors.html">Common Errors</a>. </p> </important>
Args:
stream_name: <p>The name of the stream from which to retrieve a fragment list. Specify either this parameter or the <code>StreamARN</code> parameter.</p>
stream_arn: <p>The Amazon Resource Name (ARN) of the stream from which to retrieve a fragment list. Specify either this parameter or the <code>StreamName</code> parameter.</p>
max_results: <p>The total number of fragments to return. If the total number of fragments available is more than the value specified in <code>max-results</code>, then a <a>ListFragmentsOutput$NextToken</a> is provided in the output that you can use to resume pagination.</p>
next_token: <p>A token to specify where to start paginating. This is the <a>ListFragmentsOutput$NextToken</a> from a previously truncated response.</p>
fragment_selector: <p>Describes the timestamp range and timestamp origin for the range of fragments to return.</p> <note> <p>This is only required when the <code>NextToken</code> isn't passed in the API.</p> </note>
Raises:
capo_kinesis_video_archived_media.errors.client_limit_exceeded_exception.ClientLimitExceededException: <p>Kinesis Video Streams has throttled the request because you have exceeded a limit. Try making the call later. For information about limits, see <a href="http://docs.aws.amazon.com/kinesisvideostreams/latest/dg/limits.html">Kinesis Video Streams Limits</a>.</p>
capo_kinesis_video_archived_media.errors.invalid_argument_exception.InvalidArgumentException: <p>A specified parameter exceeds its restrictions, is not supported, or can't be used.</p>
capo_kinesis_video_archived_media.errors.not_authorized_exception.NotAuthorizedException: <p>Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token has expired.</p>
capo_kinesis_video_archived_media.errors.resource_not_found_exception.ResourceNotFoundException: <p> <code>GetImages</code> will throw this error when Kinesis Video Streams can't find the stream that you specified.</p> <p> <code>GetHLSStreamingSessionURL</code> and <code>GetDASHStreamingSessionURL</code> throw this error if a session with a <code>PlaybackMode</code> of <code>ON_DEMAND</code> or <code>LIVE_REPLAY</code>is requested for a stream that has no fragments within the requested time range, or if a session with a <code>PlaybackMode</code> of <code>LIVE</code> is requested for a stream that has no fragments within the last 30 seconds.</p>
capo_kinesis_video_archived_media.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_kinesis_video_archived_media.types.list_fragments_input.ListFragmentsInput]",
) -> OperationResponse[
"capo_kinesis_video_archived_media.types.list_fragments_output.ListFragmentsOutput"
]:
import capo_kinesis_video_archived_media._operations.aws_acuity_reader.list_fragments
output, http_response = (
capo_kinesis_video_archived_media._operations.aws_acuity_reader.list_fragments.list_fragments(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListFragments")
)
input_: capo_kinesis_video_archived_media.types.list_fragments_input.ListFragmentsInput = {}
if stream_name is not None:
input_["stream_name"] = stream_name
if stream_arn is not None:
input_["stream_arn"] = stream_arn
if max_results is not None:
input_["max_results"] = max_results
if next_token is not None:
input_["next_token"] = next_token
if fragment_selector is not None:
input_["fragment_selector"] = fragment_selector
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|