Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x | // SPDX-License-Identifier: Apache-2.0
import { AccountCreationState } from '../state/AccountCreationState';
import { CleanUpState } from '../state/CleanUpState';
import { AttachState } from '../state/AttachState';
import { InitState } from '../state/InitState';
import { NetworkPrepState } from '../state/NetworkPrepState';
import { StartState } from '../state/StartState';
import { StopState } from '../state/StopState';
import { StateConfiguration } from '../types/StateConfiguration';
import { ResourceCreationState } from '../state/ResourceCreationState';
/**
* Class representing the state data.
*/
export class StateData {
/**
* Get the selected state configuration based on the state name.
* @param {string} stateName - The name of the state.
* @returns {StateConfiguration | undefined} The configuration for the selected state, or undefined if the state name is not recognized.
* @public
*/
public getSelectedStateConfiguration(stateName: string): StateConfiguration | undefined {
switch (stateName) {
case 'start':
return this.getStartConfiguration();
case 'restart':
return this.getRestartConfiguration();
case 'stop':
return this.getStopConfiguration();
case 'accountCreation':
return this.getAccountCreationConfiguration();
case 'resourceCreation':
return this.getResourceCreationConfiguration();
default:
return undefined;
}
}
/**
* Get the configuration for the restart state.
* @returns {StateConfiguration} The configuration for the restart state.
* @private
*/
private getRestartConfiguration(): StateConfiguration {
return {
'stateMachineName' : 'restart',
'states' : [
new CleanUpState(),
new StopState(),
new InitState(),
new StartState(),
new NetworkPrepState(),
new AccountCreationState(),
new ResourceCreationState(),
new CleanUpState(),
new AttachState()
]
};
}
/**
* Get the configuration for the start state.
* @returns {StateConfiguration} The configuration for the start state.
* @private
*/
private getStartConfiguration(): StateConfiguration {
return {
'stateMachineName' : 'start',
'states' : [
new InitState(),
new StartState(),
new NetworkPrepState(),
new AccountCreationState(),
new ResourceCreationState(),
new CleanUpState(),
new AttachState()
]
};
}
/**
* Get the configuration for the stop state.
* @returns {StateConfiguration} The configuration for the stop state.
* @private
*/
private getStopConfiguration(): StateConfiguration {
return {
'stateMachineName' : 'stop',
'states' : [
new StopState()
]
};
}
/**
* Get the configuration for the resource creation state.
* @returns {StateConfiguration} The configuration for the resource creation state.
* @private
*/
private getResourceCreationConfiguration(): StateConfiguration {
return {
'stateMachineName': 'resourceCreation',
'states': [
new ResourceCreationState()
]
};
}
/**
* Get the configuration for the account creation state.
* @returns {StateConfiguration} The configuration for the account creation state.
* @private
*/
private getAccountCreationConfiguration(): StateConfiguration {
return {
'stateMachineName' : 'accountCreation',
'states' : [
new AccountCreationState()
]
};
}
}
|