Skip to content

change_server_life_cycle_state

change_server_life_cycle_state(
    source_server_id: SourceServerID,
    life_cycle: ChangeServerLifeCycleStateSourceServerLifecycle,
    *,
    config_overrides: Optional[mgnClientConfig] = None,
    account_id: Optional[AccountID] = None,
) -> SourceServer

Allows the user to set the SourceServer.LifeCycle.state property for specific Source Server IDs to one of the following: READY_FOR_TEST or READY_FOR_CUTOVER. This command only works if the Source Server is already launchable (dataReplicationInfo.lagDuration is not null.)

Parameters:

Raises:

Source code in docs_src/capo_mgn/_services/mgn.py
def change_server_life_cycle_state(
    self,
    source_server_id: "capo_mgn.types.source_server_id.SourceServerID",
    life_cycle: "capo_mgn.types.change_server_life_cycle_state_source_server_lifecycle.ChangeServerLifeCycleStateSourceServerLifecycle",
    *,
    config_overrides: Optional[mgnClientConfig] = None,
    account_id: Optional["capo_mgn.types.account_id.AccountID"] = None,
) -> "capo_mgn.types.source_server.SourceServer":
    """<p>Allows the user to set the SourceServer.LifeCycle.state property for specific Source Server IDs to one of the following: READY_FOR_TEST or READY_FOR_CUTOVER. This command only works if the Source Server is already launchable (dataReplicationInfo.lagDuration is not null.)</p>

    Args:
        source_server_id: <p>The request to change the source server migration lifecycle state by source server ID.</p>
        life_cycle: <p>The request to change the source server migration lifecycle state.</p>
        account_id: <p>The request to change the source server migration account ID.</p>

    Raises:
        capo_mgn.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the target resource.</p>
        capo_mgn.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource not found exception.</p>
        capo_mgn.errors.uninitialized_account_exception.UninitializedAccountException: <p>Uninitialized account exception.</p>
        capo_mgn.errors.validation_exception.ValidationException: <p>Validate exception.</p>
        capo_mgn.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_mgn.types.change_server_life_cycle_state_request.ChangeServerLifeCycleStateRequest]",
    ) -> OperationResponse["capo_mgn.types.source_server.SourceServer"]:
        import capo_mgn._operations.application_migration_service.change_server_life_cycle_state

        output, http_response = (
            capo_mgn._operations.application_migration_service.change_server_life_cycle_state.change_server_life_cycle_state(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_mgn.types.source_server.SourceServer",
    ) -> dict[str, Any]:
        import capo_mgn.types.source_server

        return capo_mgn.types.source_server.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ChangeServerLifeCycleState", redact_output=_redact_output
        ),
    )
    input_: capo_mgn.types.change_server_life_cycle_state_request.ChangeServerLifeCycleStateRequest = {
        "source_server_id": source_server_id,
        "life_cycle": life_cycle,
    }
    if account_id is not None:
        input_["account_id"] = account_id

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