Skip to content

start_schema_extension

start_schema_extension(
    directory_id: DirectoryId,
    create_snapshot_before_schema_extension: CreateSnapshotBeforeSchemaExtension,
    ldif_content: LdifContent,
    description: Description,
    *,
    config_overrides: Optional[DirectoryServiceClientConfig] = None,
) -> StartSchemaExtensionResult

Applies a schema extension to a Microsoft AD directory.

Parameters:

  • directory_id (DirectoryId) –

    The identifier of the directory for which the schema extension will be applied to.

  • create_snapshot_before_schema_extension (CreateSnapshotBeforeSchemaExtension) –

    If true, creates a snapshot of the directory before applying the schema extension.

  • ldif_content (LdifContent) –

    The LDIF file represented as a string. To construct the LdifContent string, precede each line as it would be formatted in an ldif file with \n. See the example request below for more details. The file size can be no larger than 1MB.

  • description (Description) –

    A description of the schema extension.

Raises:

Examples:

To start a schema extension The following example applies a schema extension to a specified Microsoft AD directory.

>>> client.start_schema_extension(create_snapshot_before_schema_extension=True, directory_id='d-92654abfed', ldif_content='dn: CN=User,CN=Schema,CN=Configuration,DC=sales,DC=example,DC=com\nchangetype: modify\nadd: mayContain\nmayContain: drink\n-\n\nDN:\nchangetype: modify\nreplace: schemaupdatenow\nschemaupdatenow: 1\n-', description='Adds maycontain attribute to user class. Precede each line as it would be formatted in an ldif file.')
Source code in docs_src/capo_directory_service/_services/directory_service.py
def start_schema_extension(
    self,
    directory_id: "capo_directory_service.types.directory_id.DirectoryId",
    create_snapshot_before_schema_extension: "capo_directory_service.types.create_snapshot_before_schema_extension.CreateSnapshotBeforeSchemaExtension",
    ldif_content: "capo_directory_service.types.ldif_content.LdifContent",
    description: "capo_directory_service.types.description.Description",
    *,
    config_overrides: Optional[DirectoryServiceClientConfig] = None,
) -> "capo_directory_service.types.start_schema_extension_result.StartSchemaExtensionResult":
    r"""<p>Applies a schema extension to a Microsoft AD directory.</p>

    Args:
        directory_id: <p>The identifier of the directory for which the schema extension will be applied to.</p>
        create_snapshot_before_schema_extension: <p>If true, creates a snapshot of the directory before applying the schema extension.</p>
        ldif_content: <p>The LDIF file represented as a string. To construct the LdifContent string, precede each line as it would be formatted in an ldif file with \n. See the example request below for more details. The file size can be no larger than 1MB.</p>
        description: <p>A description of the schema extension.</p>

    Raises:
        capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
        capo_directory_service.errors.directory_unavailable_exception.DirectoryUnavailableException: <p>The specified directory is unavailable.</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_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.snapshot_limit_exceeded_exception.SnapshotLimitExceededException: <p>The maximum number of manual snapshots for the directory has been reached. You can use the <a>GetSnapshotLimits</a> operation to determine the snapshot limits for a directory.</p>
        capo_directory_service.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To start a schema extension
        The following example applies a schema extension to a specified Microsoft AD directory.

        >>> client.start_schema_extension(create_snapshot_before_schema_extension=True, directory_id='d-92654abfed', ldif_content='dn: CN=User,CN=Schema,CN=Configuration,DC=sales,DC=example,DC=com\nchangetype: modify\nadd: mayContain\nmayContain: drink\n-\n\nDN:\nchangetype: modify\nreplace: schemaupdatenow\nschemaupdatenow: 1\n-', description='Adds maycontain attribute to user class. Precede each line as it would be formatted in an ldif file.')
    """

    def _handler(
        req: "OperationRequest[capo_directory_service.types.start_schema_extension_request.StartSchemaExtensionRequest]",
    ) -> OperationResponse[
        "capo_directory_service.types.start_schema_extension_result.StartSchemaExtensionResult"
    ]:
        import capo_directory_service._operations.directory_service_20150416.start_schema_extension

        output, http_response = (
            capo_directory_service._operations.directory_service_20150416.start_schema_extension.start_schema_extension(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartSchemaExtension")
    )
    input_: capo_directory_service.types.start_schema_extension_request.StartSchemaExtensionRequest = {
        "directory_id": directory_id,
        "create_snapshot_before_schema_extension": create_snapshot_before_schema_extension,
        "ldif_content": ldif_content,
        "description": description,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output