Obtains information about the directory snapshots that belong to this account.
This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the DescribeSnapshots.NextToken member contains a token that you pass in the next call to DescribeSnapshots to retrieve the next set of items.
You can also specify a maximum number of return results with the Limit parameter.
Parameters:
-
directory_id
(Optional[DirectoryId], default:
None
)
–
The identifier of the directory for which to retrieve snapshot information.
-
snapshot_ids
(Optional[SnapshotIds], default:
None
)
–
A list of identifiers of the snapshots to obtain the information for. If this member is null or empty, all snapshots are returned using the Limit and NextToken members.
-
next_token
(Optional[NextToken], default:
None
)
–
The DescribeSnapshotsResult.NextToken value from a previous call to DescribeSnapshots. Pass null if this is the first call.
-
limit
(Optional[Limit], default:
None
)
–
The maximum number of objects to return.
Raises:
Examples:
To describe snapshots
The following example obtains information about a specified directory snapshot.
>>> client.describe_snapshots(directory_id='d-92654abfed', snapshot_ids=['s-9267f6da4e'], limit=0)
Source code in docs_src/capo_directory_service/_services/directory_service.py
| def describe_snapshots(
self,
*,
config_overrides: Optional[DirectoryServiceClientConfig] = None,
directory_id: Optional[
"capo_directory_service.types.directory_id.DirectoryId"
] = None,
snapshot_ids: Optional[
"capo_directory_service.types.snapshot_ids.SnapshotIds"
] = None,
next_token: Optional[
"capo_directory_service.types.next_token.NextToken"
] = None,
limit: Optional["capo_directory_service.types.limit.Limit"] = None,
) -> (
"capo_directory_service.types.describe_snapshots_result.DescribeSnapshotsResult"
):
"""<p>Obtains information about the directory snapshots that belong to this account.</p> <p>This operation supports pagination with the use of the <i>NextToken</i> request and response parameters. If more results are available, the <i>DescribeSnapshots.NextToken</i> member contains a token that you pass in the next call to <a>DescribeSnapshots</a> to retrieve the next set of items.</p> <p>You can also specify a maximum number of return results with the <i>Limit</i> parameter.</p>
Args:
directory_id: <p>The identifier of the directory for which to retrieve snapshot information.</p>
snapshot_ids: <p>A list of identifiers of the snapshots to obtain the information for. If this member is null or empty, all snapshots are returned using the <i>Limit</i> and <i>NextToken</i> members.</p>
next_token: <p>The <i>DescribeSnapshotsResult.NextToken</i> value from a previous call to <a>DescribeSnapshots</a>. Pass null if this is the first call.</p>
limit: <p>The maximum number of objects to return.</p>
Raises:
capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
capo_directory_service.errors.entity_does_not_exist_exception.EntityDoesNotExistException: <p>The specified entity could not be found.</p>
capo_directory_service.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The <code>NextToken</code> value is not valid.</p>
capo_directory_service.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters are not valid.</p>
capo_directory_service.errors.service_exception.ServiceException: <p>An exception has occurred in Directory Service.</p>
capo_directory_service.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To describe snapshots
The following example obtains information about a specified directory snapshot.
>>> client.describe_snapshots(directory_id='d-92654abfed', snapshot_ids=['s-9267f6da4e'], limit=0)
"""
def _handler(
req: "OperationRequest[capo_directory_service.types.describe_snapshots_request.DescribeSnapshotsRequest]",
) -> OperationResponse[
"capo_directory_service.types.describe_snapshots_result.DescribeSnapshotsResult"
]:
if req.options.protocol == "awsJson1_1":
import capo_directory_service._operations.directory_service_20150416.aws_json1_1.describe_snapshots
output, http_response = (
capo_directory_service._operations.directory_service_20150416.aws_json1_1.describe_snapshots.describe_snapshots(
req.options, req.input
)
)
elif req.options.protocol == "rpcv2Cbor":
import capo_directory_service._operations.directory_service_20150416.rpcv2_cbor.describe_snapshots
output, http_response = (
capo_directory_service._operations.directory_service_20150416.rpcv2_cbor.describe_snapshots.describe_snapshots(
req.options, req.input
)
)
else:
raise ValueError(f"unknown protocol {req.options.protocol!r}")
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DescribeSnapshots")
)
input_: capo_directory_service.types.describe_snapshots_request.DescribeSnapshotsRequest = {}
if directory_id is not None:
input_["directory_id"] = directory_id
if snapshot_ids is not None:
input_["snapshot_ids"] = snapshot_ids
if next_token is not None:
input_["next_token"] = next_token
if limit is not None:
input_["limit"] = limit
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|