Skip to content

associate_source_resource

associate_source_resource(
    progress_update_stream: ProgressUpdateStream,
    migration_task_name: MigrationTaskName,
    source_resource: SourceResource,
    *,
    config_overrides: Optional[MigrationHubClientConfig] = None,
    dry_run: Optional[DryRun] = None,
) -> AssociateSourceResourceResult

Associates a source resource with a migration task. For example, the source resource can be a source server, an application, or a migration wave.

Parameters:

  • progress_update_stream (ProgressUpdateStream) –

    The name of the progress-update stream, which is used for access control as well as a namespace for migration-task names that is implicitly linked to your AWS account. The progress-update stream must uniquely identify the migration tool as it is used for all updates made by the tool; however, it does not need to be unique for each AWS account because it is scoped to the AWS account.

  • migration_task_name (MigrationTaskName) –

    A unique identifier that references the migration task. Do not include sensitive data in this field.

  • source_resource (SourceResource) –

    The source resource that you want to associate.

  • dry_run (Optional[DryRun], default: None ) –

    This is an optional parameter that you can use to test whether the call will succeed. Set this parameter to true to verify that you have the permissions that are required to make the call, and that you have specified the other parameters in the call correctly.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • DryRunOperation –

    Exception raised to indicate a successfully authorized action when the DryRun flag is set to "true".

  • InternalServerError –

    Exception raised when an internal, configuration, or dependency error is encountered.

  • InvalidInputException –

    Exception raised when the provided input violates a policy constraint or is entered in the wrong format or data type.

  • ResourceNotFoundException –

    Exception raised when the request references a resource (Application Discovery Service configuration, update stream, migration task, etc.) that does not exist in Application Discovery Service (Application Discovery Service) or in Migration Hub's repository.

  • ServiceUnavailableException –

    Exception raised when there is an internal, configuration, or dependency error encountered.

  • ThrottlingException –

    The request was denied due to request throttling.

  • UnauthorizedOperation –

    Exception raised to indicate a request was not authorized when the DryRun flag is set to "true".

  • UnknownServiceError –

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

Source code in docs_src/capo_migration_hub/_services/migration_hub.py
def associate_source_resource(
    self,
    progress_update_stream: "capo_migration_hub.types.progress_update_stream.ProgressUpdateStream",
    migration_task_name: "capo_migration_hub.types.migration_task_name.MigrationTaskName",
    source_resource: "capo_migration_hub.types.source_resource.SourceResource",
    *,
    config_overrides: Optional[MigrationHubClientConfig] = None,
    dry_run: Optional["capo_migration_hub.types.dry_run.DryRun"] = None,
) -> "capo_migration_hub.types.associate_source_resource_result.AssociateSourceResourceResult":
    """<p>Associates a source resource with a migration task. For example, the source resource can be a source server, an application, or a migration wave.</p>

    Args:
        progress_update_stream: <p>The name of the progress-update stream, which is used for access control as well as a namespace for migration-task names that is implicitly linked to your AWS account. The progress-update stream must uniquely identify the migration tool as it is used for all updates made by the tool; however, it does not need to be unique for each AWS account because it is scoped to the AWS account.</p>
        migration_task_name: <p>A unique identifier that references the migration task. <i>Do not include sensitive data in this field.</i> </p>
        source_resource: <p>The source resource that you want to associate.</p>
        dry_run: <p>This is an optional parameter that you can use to test whether the call will succeed. Set this parameter to <code>true</code> to verify that you have the permissions that are required to make the call, and that you have specified the other parameters in the call correctly.</p>

    Raises:
        capo_migration_hub.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_migration_hub.errors.dry_run_operation.DryRunOperation: <p>Exception raised to indicate a successfully authorized action when the <code>DryRun</code> flag is set to "true".</p>
        capo_migration_hub.errors.internal_server_error.InternalServerError: <p>Exception raised when an internal, configuration, or dependency error is encountered.</p>
        capo_migration_hub.errors.invalid_input_exception.InvalidInputException: <p>Exception raised when the provided input violates a policy constraint or is entered in the wrong format or data type.</p>
        capo_migration_hub.errors.resource_not_found_exception.ResourceNotFoundException: <p>Exception raised when the request references a resource (Application Discovery Service configuration, update stream, migration task, etc.) that does not exist in Application Discovery Service (Application Discovery Service) or in Migration Hub's repository.</p>
        capo_migration_hub.errors.service_unavailable_exception.ServiceUnavailableException: <p>Exception raised when there is an internal, configuration, or dependency error encountered.</p>
        capo_migration_hub.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_migration_hub.errors.unauthorized_operation.UnauthorizedOperation: <p>Exception raised to indicate a request was not authorized when the <code>DryRun</code> flag is set to "true".</p>
        capo_migration_hub.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_migration_hub.types.associate_source_resource_request.AssociateSourceResourceRequest]",
    ) -> OperationResponse[
        "capo_migration_hub.types.associate_source_resource_result.AssociateSourceResourceResult"
    ]:
        import capo_migration_hub._operations.aws_migration_hub.associate_source_resource

        output, http_response = (
            capo_migration_hub._operations.aws_migration_hub.associate_source_resource.associate_source_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateSourceResource")
    )
    input_: capo_migration_hub.types.associate_source_resource_request.AssociateSourceResourceRequest = {
        "progress_update_stream": progress_update_stream,
        "migration_task_name": migration_task_name,
        "source_resource": source_resource,
    }
    if dry_run is not None:
        input_["dry_run"] = dry_run

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