Obtains information about the directories that belong to this account.
You can retrieve information about specific directories by passing the directory identifiers in the DirectoryIds parameter. Otherwise, all directories that belong to the current account are returned.
This operation supports pagination with the use of the NextToken request and response parameters. If more results are available, the DescribeDirectoriesResult.NextToken member contains a token that you pass in the next call to DescribeDirectories to retrieve the next set of items.
You can also specify a maximum number of return results with the Limit parameter.
Parameters:
-
directory_ids
(Optional[DirectoryIds], default:
None
)
–
A list of identifiers of the directories for which to obtain the information. If this member is null, all directories that belong to the current account are returned.
An empty list results in an InvalidParameterException being thrown.
-
next_token
(Optional[NextToken], default:
None
)
–
The DescribeDirectoriesResult.NextToken value from a previous call to DescribeDirectories. Pass null if this is the first call.
-
limit
(Optional[Limit], default:
None
)
–
The maximum number of items to return. If this value is zero, the maximum number of items is specified by the limitations of the operation.
Raises:
Examples:
To describe one or more directories
The following example obtains information about a specified directory.
>>> await client.describe_directories(directory_ids=['d-92654abfed'], limit=0)
Source code in docs_src/capo_directory_service/_services/async_directory_service.py
| async def describe_directories(
self,
*,
config_overrides: Optional[AsyncDirectoryServiceClientConfig] = None,
directory_ids: Optional[
"capo_directory_service.types.directory_ids.DirectoryIds"
] = 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_directories_result.DescribeDirectoriesResult":
"""<p>Obtains information about the directories that belong to this account.</p> <p>You can retrieve information about specific directories by passing the directory identifiers in the <code>DirectoryIds</code> parameter. Otherwise, all directories that belong to the current account are returned.</p> <p>This operation supports pagination with the use of the <code>NextToken</code> request and response parameters. If more results are available, the <code>DescribeDirectoriesResult.NextToken</code> member contains a token that you pass in the next call to <a>DescribeDirectories</a> to retrieve the next set of items.</p> <p>You can also specify a maximum number of return results with the <code>Limit</code> parameter.</p>
Args:
directory_ids: <p>A list of identifiers of the directories for which to obtain the information. If this member is null, all directories that belong to the current account are returned.</p> <p>An empty list results in an <code>InvalidParameterException</code> being thrown.</p>
next_token: <p>The <code>DescribeDirectoriesResult.NextToken</code> value from a previous call to <a>DescribeDirectories</a>. Pass null if this is the first call.</p>
limit: <p>The maximum number of items to return. If this value is zero, the maximum number of items is specified by the limitations of the operation.</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 one or more directories
The following example obtains information about a specified directory.
>>> await client.describe_directories(directory_ids=['d-92654abfed'], limit=0)
"""
async def _handler(
req: "AsyncOperationRequest[capo_directory_service.types.describe_directories_request.DescribeDirectoriesRequest]",
) -> AsyncOperationResponse[
"capo_directory_service.types.describe_directories_result.DescribeDirectoriesResult"
]:
import capo_directory_service._operations.directory_service_20150416.describe_directories
(
output,
http_response,
) = await capo_directory_service._operations.directory_service_20150416.describe_directories.async_describe_directories(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_directory_service.types.describe_directories_result.DescribeDirectoriesResult",
) -> dict[str, Any]:
import capo_directory_service.types.describe_directories_result
return capo_directory_service.types.describe_directories_result.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("DescribeDirectories", redact_output=_redact_output),
)
input_: capo_directory_service.types.describe_directories_request.DescribeDirectoriesRequest = {}
if directory_ids is not None:
input_["directory_ids"] = directory_ids
if next_token is not None:
input_["next_token"] = next_token
if limit is not None:
input_["limit"] = limit
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|