public async Task <IProvisioningState> GetInitialStateAsync(
     InitialStateContext context)
 {
     return(context.StateFactory.Create <CreateLightsailInstanceState>(state =>
     {
         state.DatabaseInstance = this.databaseInstance;
         state.PlanId = this.planId;
     }));
 }
        public async Task <IProvisioningState> GetInitialStateAsync(InitialStateContext context)
        {
            if (this.firstFlow != this.currentFlow)
            {
                throw new InvalidOperationException("The first flow is not the active flow, so the initial state can't be fetched.");
            }

            return(await this.firstFlow.GetInitialStateAsync(context));
        }
        public async Task <IProvisioningState> GetInitialStateAsync(InitialStateContext context)
        {
            var amazonInstance = await context.Mediator.Send(
                new GetLightsailInstanceByNameQuery(InstanceName));

            if (amazonInstance == null)
            {
                throw new InvalidOperationException("Instance was not found.");
            }

            return(context.StateFactory.Create <RunDockerComposeOnInstanceState>(state =>
            {
                state.BuildArguments = BuildArguments;
                state.DockerComposeYmlFilePaths = this.DockerComposeYmlFilePaths;
                state.InstanceName = InstanceName;
                state.IpAddress = amazonInstance.PublicIpAddress;
                state.Authentication = Authentication;
                state.Files = this.Files;
            }));
        }