Skip to content

modify_document_permission async

modify_document_permission(
    name: DocumentName,
    permission_type: DocumentPermissionType,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    account_ids_to_add: Optional[AccountIdList] = None,
    account_ids_to_remove: Optional[AccountIdList] = None,
    shared_document_version: Optional[SharedDocumentVersion] = None,
) -> ModifyDocumentPermissionResponse

Shares a Amazon Web Services Systems Manager document (SSM document)publicly or privately. If you share a document privately, you must specify the Amazon Web Services user IDs for those people who can use the document. If you share a document publicly, you must specify All as the account ID.

Parameters:

  • name (DocumentName) –

    The name of the document that you want to share.

  • permission_type (DocumentPermissionType) –

    The permission type for the document. The permission type can be Share.

  • account_ids_to_add (Optional[AccountIdList], default: None ) –

    The Amazon Web Services users that should have access to the document. The account IDs can either be a group of account IDs or All. You must specify a value for this parameter or the AccountIdsToRemove parameter.

  • account_ids_to_remove (Optional[AccountIdList], default: None ) –

    The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can either be a group of account IDs or All. This action has a higher priority than AccountIdsToAdd. If you specify an ID to add and the same ID to remove, the system removes access to the document. You must specify a value for this parameter or the AccountIdsToAdd parameter.

  • shared_document_version (Optional[SharedDocumentVersion], default: None ) –

    (Optional) The version of the document to share. If it isn't specified, the system choose the Default version to share.

Raises:

  • DocumentLimitExceeded –

    You can have at most 500 active SSM documents.

  • DocumentPermissionLimit –

    The document can't be shared with more Amazon Web Services accounts. You can specify a maximum of 20 accounts per API operation to share a private document.

    By default, you can share a private document with a maximum of 1,000 accounts and publicly share up to five documents.

    If you need to increase the quota for privately or publicly shared Systems Manager documents, contact Amazon Web Services Support.

  • InternalServerError –

    An error occurred on the server side.

  • InvalidDocument –

    The specified SSM document doesn't exist.

  • InvalidPermissionType –

    The permission type isn't supported. Share is the only supported permission type.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def modify_document_permission(
    self,
    name: "capo_ssm.types.document_name.DocumentName",
    permission_type: "capo_ssm.types.document_permission_type.DocumentPermissionType",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    account_ids_to_add: Optional[
        "capo_ssm.types.account_id_list.AccountIdList"
    ] = None,
    account_ids_to_remove: Optional[
        "capo_ssm.types.account_id_list.AccountIdList"
    ] = None,
    shared_document_version: Optional[
        "capo_ssm.types.shared_document_version.SharedDocumentVersion"
    ] = None,
) -> "capo_ssm.types.modify_document_permission_response.ModifyDocumentPermissionResponse":
    """<p>Shares a Amazon Web Services Systems Manager document (SSM document)publicly or privately. If you share a document privately, you must specify the Amazon Web Services user IDs for those people who can use the document. If you share a document publicly, you must specify <i>All</i> as the account ID.</p>

    Args:
        name: <p>The name of the document that you want to share.</p>
        permission_type: <p>The permission type for the document. The permission type can be <i>Share</i>.</p>
        account_ids_to_add: <p>The Amazon Web Services users that should have access to the document. The account IDs can either be a group of account IDs or <i>All</i>. You must specify a value for this parameter or the <code>AccountIdsToRemove</code> parameter.</p>
        account_ids_to_remove: <p>The Amazon Web Services users that should no longer have access to the document. The Amazon Web Services user can either be a group of account IDs or <i>All</i>. This action has a higher priority than <code>AccountIdsToAdd</code>. If you specify an ID to add and the same ID to remove, the system removes access to the document. You must specify a value for this parameter or the <code>AccountIdsToAdd</code> parameter.</p>
        shared_document_version: <p>(Optional) The version of the document to share. If it isn't specified, the system choose the <code>Default</code> version to share.</p>

    Raises:
        capo_ssm.errors.document_limit_exceeded.DocumentLimitExceeded: <p>You can have at most 500 active SSM documents.</p>
        capo_ssm.errors.document_permission_limit.DocumentPermissionLimit: <p>The document can't be shared with more Amazon Web Services accounts. You can specify a maximum of 20 accounts per API operation to share a private document.</p> <p>By default, you can share a private document with a maximum of 1,000 accounts and publicly share up to five documents.</p> <p>If you need to increase the quota for privately or publicly shared Systems Manager documents, contact Amazon Web Services Support.</p>
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_document.InvalidDocument: <p>The specified SSM document doesn't exist.</p>
        capo_ssm.errors.invalid_permission_type.InvalidPermissionType: <p>The permission type isn't supported. <i>Share</i> is the only supported permission type.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.modify_document_permission_request.ModifyDocumentPermissionRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.modify_document_permission_response.ModifyDocumentPermissionResponse"
    ]:
        import capo_ssm._operations.amazon_ssm.modify_document_permission

        (
            output,
            http_response,
        ) = await capo_ssm._operations.amazon_ssm.modify_document_permission.async_modify_document_permission(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyDocumentPermission")
    )
    input_: capo_ssm.types.modify_document_permission_request.ModifyDocumentPermissionRequest = {
        "name": name,
        "permission_type": permission_type,
    }
    if account_ids_to_add is not None:
        input_["account_ids_to_add"] = account_ids_to_add
    if account_ids_to_remove is not None:
        input_["account_ids_to_remove"] = account_ids_to_remove
    if shared_document_version is not None:
        input_["shared_document_version"] = shared_document_version

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output