Skip to content

update_agreement

update_agreement(
    agreement_id: AgreementId,
    server_id: ServerId,
    *,
    config_overrides: Optional[TransferClientConfig] = None,
    description: Optional[Description] = None,
    status: Optional[AgreementStatusType] = None,
    local_profile_id: Optional[ProfileId] = None,
    partner_profile_id: Optional[ProfileId] = None,
    base_directory: Optional[HomeDirectory] = None,
    access_role: Optional[Role] = None,
    preserve_filename: Optional[PreserveFilenameType] = None,
    enforce_message_signing: Optional[EnforceMessageSigningType] = None,
    custom_directories: Optional[CustomDirectoriesType] = None,
) -> UpdateAgreementResponse

Updates some of the parameters for an existing agreement. Provide the AgreementId and the ServerId for the agreement that you want to update, along with the new values for the parameters to update.

Specify either BaseDirectory or CustomDirectories, but not both. Specifying both causes the command to fail.

If you update an agreement from using base directory to custom directories, the base directory is no longer used. Similarly, if you change from custom directories to a base directory, the custom directories are no longer used.

Parameters:

  • agreement_id (AgreementId) –

    A unique identifier for the agreement. This identifier is returned when you create an agreement.

  • server_id (ServerId) –

    A system-assigned unique identifier for a server instance. This is the specific server that the agreement uses.

  • description (Optional[Description], default: None ) –

    To replace the existing description, provide a short description for the agreement.

  • status (Optional[AgreementStatusType], default: None ) –

    You can update the status for the agreement, either activating an inactive agreement or the reverse.

  • local_profile_id (Optional[ProfileId], default: None ) –

    A unique identifier for the AS2 local profile.

    To change the local profile identifier, provide a new value here.

  • partner_profile_id (Optional[ProfileId], default: None ) –

    A unique identifier for the partner profile. To change the partner profile identifier, provide a new value here.

  • base_directory (Optional[HomeDirectory], default: None ) –

    To change the landing directory (folder) for files that are transferred, provide the bucket folder that you want to use; for example, /amzn-s3-demo-bucket/home/mydirectory .

  • access_role (Optional[Role], default: None ) –

    Connectors are used to send files using either the AS2 or SFTP protocol. For the access role, provide the Amazon Resource Name (ARN) of the Identity and Access Management role to use.

    For AS2 connectors

    With AS2, you can send files by calling StartFileTransfer and specifying the file paths in the request parameter, SendFilePaths. We use the file’s parent directory (for example, for --send-file-paths /bucket/dir/file.txt, parent directory is /bucket/dir/) to temporarily store a processed AS2 message file, store the MDN when we receive them from the partner, and write a final JSON file containing relevant metadata of the transmission. So, the AccessRole needs to provide read and write access to the parent directory of the file location used in the StartFileTransfer request. Additionally, you need to provide read and write access to the parent directory of the files that you intend to send with StartFileTransfer.

    If you are using Basic authentication for your AS2 connector, the access role requires the secretsmanager:GetSecretValue permission for the secret. If the secret is encrypted using a customer-managed key instead of the Amazon Web Services managed key in Secrets Manager, then the role also needs the kms:Decrypt permission for that key.

    For SFTP connectors

    Make sure that the access role provides read and write access to the parent directory of the file location that's used in the StartFileTransfer request. Additionally, make sure that the role provides secretsmanager:GetSecretValue permission to Secrets Manager.

  • preserve_filename (Optional[PreserveFilenameType], default: None ) –

    Determines whether or not Transfer Family appends a unique string of characters to the end of the AS2 message payload filename when saving it.

    • ENABLED: the filename provided by your trading parter is preserved when the file is saved.

    • DISABLED (default value): when Transfer Family saves the file, the filename is adjusted, as described in File names and locations.

  • enforce_message_signing (Optional[EnforceMessageSigningType], default: None ) –

    Determines whether or not unsigned messages from your trading partners will be accepted.

    • ENABLED: Transfer Family rejects unsigned messages from your trading partner.

    • DISABLED (default value): Transfer Family accepts unsigned messages from your trading partner.

  • custom_directories (Optional[CustomDirectoriesType], default: None ) –

    A CustomDirectoriesType structure. This structure specifies custom directories for storing various AS2 message files. You can specify directories for the following types of files.

    • Failed files

    • MDN files

    • Payload files

    • Status files

    • Temporary files

Raises:

Source code in docs_src/capo_transfer/_services/transfer.py
def update_agreement(
    self,
    agreement_id: "capo_transfer.types.agreement_id.AgreementId",
    server_id: "capo_transfer.types.server_id.ServerId",
    *,
    config_overrides: Optional[TransferClientConfig] = None,
    description: Optional["capo_transfer.types.description.Description"] = None,
    status: Optional[
        "capo_transfer.types.agreement_status_type.AgreementStatusType"
    ] = None,
    local_profile_id: Optional["capo_transfer.types.profile_id.ProfileId"] = None,
    partner_profile_id: Optional["capo_transfer.types.profile_id.ProfileId"] = None,
    base_directory: Optional[
        "capo_transfer.types.home_directory.HomeDirectory"
    ] = None,
    access_role: Optional["capo_transfer.types.role.Role"] = None,
    preserve_filename: Optional[
        "capo_transfer.types.preserve_filename_type.PreserveFilenameType"
    ] = None,
    enforce_message_signing: Optional[
        "capo_transfer.types.enforce_message_signing_type.EnforceMessageSigningType"
    ] = None,
    custom_directories: Optional[
        "capo_transfer.types.custom_directories_type.CustomDirectoriesType"
    ] = None,
) -> "capo_transfer.types.update_agreement_response.UpdateAgreementResponse":
    """<p>Updates some of the parameters for an existing agreement. Provide the <code>AgreementId</code> and the <code>ServerId</code> for the agreement that you want to update, along with the new values for the parameters to update.</p> <note> <p>Specify <i>either</i> <code>BaseDirectory</code> or <code>CustomDirectories</code>, but not both. Specifying both causes the command to fail.</p> <p>If you update an agreement from using base directory to custom directories, the base directory is no longer used. Similarly, if you change from custom directories to a base directory, the custom directories are no longer used.</p> </note>

    Args:
        agreement_id: <p>A unique identifier for the agreement. This identifier is returned when you create an agreement.</p>
        server_id: <p>A system-assigned unique identifier for a server instance. This is the specific server that the agreement uses.</p>
        description: <p>To replace the existing description, provide a short description for the agreement. </p>
        status: <p>You can update the status for the agreement, either activating an inactive agreement or the reverse.</p>
        local_profile_id: <p>A unique identifier for the AS2 local profile.</p> <p>To change the local profile identifier, provide a new value here.</p>
        partner_profile_id: <p>A unique identifier for the partner profile. To change the partner profile identifier, provide a new value here.</p>
        base_directory: <p>To change the landing directory (folder) for files that are transferred, provide the bucket folder that you want to use; for example, <code>/<i>amzn-s3-demo-bucket</i>/<i>home</i>/<i>mydirectory</i> </code>.</p>
        access_role: <p>Connectors are used to send files using either the AS2 or SFTP protocol. For the access role, provide the Amazon Resource Name (ARN) of the Identity and Access Management role to use.</p> <p> <b>For AS2 connectors</b> </p> <p>With AS2, you can send files by calling <code>StartFileTransfer</code> and specifying the file paths in the request parameter, <code>SendFilePaths</code>. We use the file’s parent directory (for example, for <code>--send-file-paths /bucket/dir/file.txt</code>, parent directory is <code>/bucket/dir/</code>) to temporarily store a processed AS2 message file, store the MDN when we receive them from the partner, and write a final JSON file containing relevant metadata of the transmission. So, the <code>AccessRole</code> needs to provide read and write access to the parent directory of the file location used in the <code>StartFileTransfer</code> request. Additionally, you need to provide read and write access to the parent directory of the files that you intend to send with <code>StartFileTransfer</code>.</p> <p>If you are using Basic authentication for your AS2 connector, the access role requires the <code>secretsmanager:GetSecretValue</code> permission for the secret. If the secret is encrypted using a customer-managed key instead of the Amazon Web Services managed key in Secrets Manager, then the role also needs the <code>kms:Decrypt</code> permission for that key.</p> <p> <b>For SFTP connectors</b> </p> <p>Make sure that the access role provides read and write access to the parent directory of the file location that's used in the <code>StartFileTransfer</code> request. Additionally, make sure that the role provides <code>secretsmanager:GetSecretValue</code> permission to Secrets Manager.</p>
        preserve_filename: <p> Determines whether or not Transfer Family appends a unique string of characters to the end of the AS2 message payload filename when saving it. </p> <ul> <li> <p> <code>ENABLED</code>: the filename provided by your trading parter is preserved when the file is saved.</p> </li> <li> <p> <code>DISABLED</code> (default value): when Transfer Family saves the file, the filename is adjusted, as described in <a href="https://docs.aws.amazon.com/transfer/latest/userguide/send-as2-messages.html#file-names-as2">File names and locations</a>.</p> </li> </ul>
        enforce_message_signing: <p> Determines whether or not unsigned messages from your trading partners will be accepted. </p> <ul> <li> <p> <code>ENABLED</code>: Transfer Family rejects unsigned messages from your trading partner.</p> </li> <li> <p> <code>DISABLED</code> (default value): Transfer Family accepts unsigned messages from your trading partner.</p> </li> </ul>
        custom_directories: <p>A <code>CustomDirectoriesType</code> structure. This structure specifies custom directories for storing various AS2 message files. You can specify directories for the following types of files.</p> <ul> <li> <p>Failed files</p> </li> <li> <p>MDN files</p> </li> <li> <p>Payload files</p> </li> <li> <p>Status files</p> </li> <li> <p>Temporary files</p> </li> </ul>

    Raises:
        capo_transfer.errors.internal_service_error.InternalServiceError: <p>This exception is thrown when an error occurs in the Transfer Family service.</p>
        capo_transfer.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_transfer.errors.resource_exists_exception.ResourceExistsException: <p>The requested resource does not exist, or exists in a region other than the one specified for the command.</p>
        capo_transfer.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when a resource is not found by the Amazon Web ServicesTransfer Family service.</p>
        capo_transfer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed because the Amazon Web ServicesTransfer Family service is not available.</p>
        capo_transfer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_transfer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_transfer.types.update_agreement_request.UpdateAgreementRequest]",
    ) -> OperationResponse[
        "capo_transfer.types.update_agreement_response.UpdateAgreementResponse"
    ]:
        import capo_transfer._operations.transfer_service.update_agreement

        output, http_response = (
            capo_transfer._operations.transfer_service.update_agreement.update_agreement(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateAgreement")
    )
    input_: capo_transfer.types.update_agreement_request.UpdateAgreementRequest = {
        "agreement_id": agreement_id,
        "server_id": server_id,
    }
    if description is not None:
        input_["description"] = description
    if status is not None:
        input_["status"] = status
    if local_profile_id is not None:
        input_["local_profile_id"] = local_profile_id
    if partner_profile_id is not None:
        input_["partner_profile_id"] = partner_profile_id
    if base_directory is not None:
        input_["base_directory"] = base_directory
    if access_role is not None:
        input_["access_role"] = access_role
    if preserve_filename is not None:
        input_["preserve_filename"] = preserve_filename
    if enforce_message_signing is not None:
        input_["enforce_message_signing"] = enforce_message_signing
    if custom_directories is not None:
        input_["custom_directories"] = custom_directories

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