internal void PersistSettings(ECSBaseCommand command, JsonData data)
        {
            data.SetIfNotNull(CommonDefinedCommandOptions.ARGUMENT_CONFIGURATION.ConfigFileKey, command.GetStringValueOrDefault(this.Configuration, CommonDefinedCommandOptions.ARGUMENT_CONFIGURATION, false));
            data.SetIfNotNull(CommonDefinedCommandOptions.ARGUMENT_FRAMEWORK.ConfigFileKey, command.GetStringValueOrDefault(this.TargetFramework, CommonDefinedCommandOptions.ARGUMENT_FRAMEWORK, false));
            data.SetIfNotNull(CommonDefinedCommandOptions.ARGUMENT_PUBLISH_OPTIONS.ConfigFileKey, command.GetStringValueOrDefault(this.PublishOptions, CommonDefinedCommandOptions.ARGUMENT_PUBLISH_OPTIONS, false));


            var tag = command.GetStringValueOrDefault(this.DockerImageTag, ECSDefinedCommandOptions.ARGUMENT_DOCKER_TAG, false);

            if (!string.IsNullOrEmpty(tag))
            {
                // Strip the full ECR URL name of form - protocol://aws_account_id.dkr.ecr.region.amazonaws.domain/repository:tag
                // irrespective of domain
                int dkrPos = tag.IndexOf(".dkr.ecr");
                if (dkrPos != -1)
                {
                    tag = tag.Substring(dkrPos + 1);
                    int pos = tag.IndexOf('/');
                    if (pos != -1)
                    {
                        tag = tag.Substring(pos + 1);
                    }
                }

                data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_DOCKER_TAG.ConfigFileKey, tag);
            }

            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_DOCKER_BUILD_WORKING_DIRECTORY.ConfigFileKey, command.GetStringValueOrDefault(this.DockerBuildWorkingDirectory, ECSDefinedCommandOptions.ARGUMENT_DOCKER_BUILD_WORKING_DIRECTORY, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_DOCKER_BUILD_OPTIONS.ConfigFileKey, command.GetStringValueOrDefault(this.DockerBuildOptions, ECSDefinedCommandOptions.ARGUMENT_DOCKER_BUILD_OPTIONS, false));
        }
        internal void PersistSettings(ECSBaseCommand command, JsonData data)
        {
            data.SetIfNotNull(CommonDefinedCommandOptions.ARGUMENT_CONFIGURATION.ConfigFileKey, command.GetStringValueOrDefault(this.Configuration, CommonDefinedCommandOptions.ARGUMENT_CONFIGURATION, false));
            data.SetIfNotNull(CommonDefinedCommandOptions.ARGUMENT_FRAMEWORK.ConfigFileKey, command.GetStringValueOrDefault(this.TargetFramework, CommonDefinedCommandOptions.ARGUMENT_FRAMEWORK, false));

            var tag = command.GetStringValueOrDefault(this.DockerImageTag, ECSDefinedCommandOptions.ARGUMENT_DOCKER_TAG, false);

            if (!string.IsNullOrEmpty(tag))
            {
                // Strip the full ECR URL name.
                int pos = tag.LastIndexOf('/');
                if (pos != -1)
                {
                    tag = tag.Substring(pos + 1);
                }

                data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_DOCKER_TAG.ConfigFileKey, tag);
            }
        }
 internal void PersistSettings(ECSBaseCommand command, JsonData data)
 {
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_SCHEDULED_RULE_NAME.ConfigFileKey, command.GetStringValueOrDefault(this.ScheduleTaskRule, ECSDefinedCommandOptions.ARGUMENT_SCHEDULED_RULE_NAME, false));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_SCHEDULED_RULE_TARGET.ConfigFileKey, command.GetStringValueOrDefault(this.ScheduleTaskRuleTarget, ECSDefinedCommandOptions.ARGUMENT_SCHEDULED_RULE_TARGET, false));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_SCHEDULE_EXPRESSION.ConfigFileKey, command.GetStringValueOrDefault(this.ScheduleExpression, ECSDefinedCommandOptions.ARGUMENT_SCHEDULE_EXPRESSION, false));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CLOUDWATCHEVENT_ROLE.ConfigFileKey, command.GetStringValueOrDefault(this.CloudWatchEventIAMRole, ECSDefinedCommandOptions.ARGUMENT_CLOUDWATCHEVENT_ROLE, false));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ECS_DESIRED_COUNT.ConfigFileKey, command.GetIntValueOrDefault(this.DesiredCount, ECSDefinedCommandOptions.ARGUMENT_ECS_DESIRED_COUNT, false));
 }
        internal void PersistSettings(ECSBaseCommand command, JsonData data)
        {
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ECS_TASK_GROUP.ConfigFileKey, command.GetStringValueOrDefault(this.TaskGroup, ECSDefinedCommandOptions.ARGUMENT_ECS_TASK_GROUP, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ECS_TASK_COUNT.ConfigFileKey, command.GetIntValueOrDefault(this.TaskCount, ECSDefinedCommandOptions.ARGUMENT_ECS_TASK_COUNT, false));

            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_CONSTRAINTS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.PlacementConstraints, ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_CONSTRAINTS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_STRATEGY.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.PlacementStrategy, ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_STRATEGY, false)));
        }
        internal void PersistSettings(ECSBaseCommand command, JsonData data)
        {
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_SKIP_IMAGE_PUSH.ConfigFileKey, command.GetBoolValueOrDefault(this.SkipImagePush, ECSDefinedCommandOptions.ARGUMENT_SKIP_IMAGE_PUSH, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ECS_SERVICE.ConfigFileKey, command.GetStringValueOrDefault(this.ECSService, ECSDefinedCommandOptions.ARGUMENT_ECS_SERVICE, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ECS_DESIRED_COUNT.ConfigFileKey, command.GetIntValueOrDefault(this.DesiredCount, ECSDefinedCommandOptions.ARGUMENT_ECS_DESIRED_COUNT, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_DEPLOYMENT_MINIMUM_HEALTHY_PERCENT.ConfigFileKey, command.GetIntValueOrDefault(this.DeploymentMinimumHealthyPercent, ECSDefinedCommandOptions.ARGUMENT_DEPLOYMENT_MINIMUM_HEALTHY_PERCENT, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_DEPLOYMENT_MAXIMUM_PERCENT.ConfigFileKey, command.GetIntValueOrDefault(this.DeploymentMaximumPercent, ECSDefinedCommandOptions.ARGUMENT_DEPLOYMENT_MAXIMUM_PERCENT, false));

            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ELB_SERVICE_ROLE.ConfigFileKey, command.GetStringValueOrDefault(this.ELBServiceRole, ECSDefinedCommandOptions.ARGUMENT_ELB_SERVICE_ROLE, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ELB_TARGET_GROUP_ARN.ConfigFileKey, command.GetStringValueOrDefault(this.ELBTargetGroup, ECSDefinedCommandOptions.ARGUMENT_ELB_TARGET_GROUP_ARN, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ELB_CONTAINER_PORT.ConfigFileKey, command.GetIntValueOrDefault(this.ELBContainerPort, ECSDefinedCommandOptions.ARGUMENT_ELB_CONTAINER_PORT, false));

            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_CONSTRAINTS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.PlacementConstraints, ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_CONSTRAINTS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_STRATEGY.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.PlacementStrategy, ECSDefinedCommandOptions.ARGUMENT_PLACEMENT_STRATEGY, false)));
        }
        internal void PersistSettings(ECSBaseCommand command, JsonData data)
        {
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_NAME.ConfigFileKey, command.GetStringValueOrDefault(this.TaskDefinitionName, ECSDefinedCommandOptions.ARGUMENT_TD_NAME, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_NETWORK_MODE.ConfigFileKey, command.GetStringValueOrDefault(this.TaskDefinitionNetworkMode, ECSDefinedCommandOptions.ARGUMENT_TD_NETWORK_MODE, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_CPU.ConfigFileKey, command.GetStringValueOrDefault(this.TaskCPU, ECSDefinedCommandOptions.ARGUMENT_TD_CPU, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_MEMORY.ConfigFileKey, command.GetStringValueOrDefault(this.TaskMemory, ECSDefinedCommandOptions.ARGUMENT_TD_MEMORY, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_ROLE.ConfigFileKey, command.GetStringValueOrDefault(this.TaskDefinitionRole, ECSDefinedCommandOptions.ARGUMENT_TD_ROLE, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_EXECUTION_ROLE.ConfigFileKey, command.GetStringValueOrDefault(this.TaskDefinitionExecutionRole, ECSDefinedCommandOptions.ARGUMENT_TD_EXECUTION_ROLE, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_TD_VOLUMES.ConfigFileKey, command.GetStringValueOrDefault(this.TaskDefinitionVolumes, ECSDefinedCommandOptions.ARGUMENT_TD_VOLUMES, false));

            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_COMMANDS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerCommands, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_COMMANDS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DISABLE_NETWORKING.ConfigFileKey, command.GetBoolValueOrDefault(this.ContainerDisableNetworking, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DISABLE_NETWORKING, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DNS_SEARCH_DOMAINS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerDNSSearchDomains, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DNS_SEARCH_DOMAINS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DNS_SERVERS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerDNSServers, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DNS_SERVERS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DOCKER_LABELS.ConfigFileKey, ECSToolsDefaults.FormatKeyValue(command.GetKeyValuePairOrDefault(this.ContainerDockerLabels, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DOCKER_LABELS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DOCKER_SECURITY_OPTIONS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerDockerSecurityOptions, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_DOCKER_SECURITY_OPTIONS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ENTRY_POINT.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerEntryPoint, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ENTRY_POINT, false)));

            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ESSENTIAL.ConfigFileKey, command.GetBoolValueOrDefault(this.ContainerEssential, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ESSENTIAL, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_EXTRA_HOSTS.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerExtraHosts, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_EXTRA_HOSTS, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_HOSTNAME.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerHostname, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_HOSTNAME, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_LINKS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerLinks, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_LINKS, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_LINUX_PARAMETERS.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerLinuxParameters, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_LINUX_PARAMETERS, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_LOG_CONFIGURATION.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerLogConfiguration, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_LOG_CONFIGURATION, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_MOUNT_POINTS.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerMountPoints, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_MOUNT_POINTS, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_PRIVILEGED.ConfigFileKey, command.GetBoolValueOrDefault(this.ContainerPrivileged, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_PRIVILEGED, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_READONLY_ROOT_FILESYSTEM.ConfigFileKey, command.GetBoolValueOrDefault(this.ContainerReadonlyRootFilesystem, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_READONLY_ROOT_FILESYSTEM, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ULIMITS.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerUlimits, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ULIMITS, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_USER.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerUlimits, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_USER, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_VOLUMES_FROM.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerVolumesFrom, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_VOLUMES_FROM, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_WORKING_DIRECTORY.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerWorkingDirectory, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_WORKING_DIRECTORY, false));



            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_NAME.ConfigFileKey, command.GetStringValueOrDefault(this.ContainerName, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_NAME, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_MEMORY_HARD_LIMIT.ConfigFileKey, command.GetIntValueOrDefault(this.ContainerMemoryHardLimit, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_MEMORY_HARD_LIMIT, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_MEMORY_SOFT_LIMIT.ConfigFileKey, command.GetIntValueOrDefault(this.ContainerMemorySoftLimit, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_MEMORY_SOFT_LIMIT, false));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_PORT_MAPPING.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.ContainerPortMappings, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_PORT_MAPPING, false)));
            data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ENVIRONMENT_VARIABLES.ConfigFileKey, ECSToolsDefaults.FormatKeyValue(command.GetKeyValuePairOrDefault(this.ContainerEnvironmentVariables, ECSDefinedCommandOptions.ARGUMENT_CONTAINER_ENVIRONMENT_VARIABLES, false)));
        }
 internal void PersistSettings(ECSBaseCommand command, JsonData data)
 {
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_ECS_CLUSTER.ConfigFileKey, command.GetStringValueOrDefault(this.ECSCluster, ECSDefinedCommandOptions.ARGUMENT_ECS_CLUSTER, false));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_LAUNCH_TYPE.ConfigFileKey, command.GetStringValueOrDefault(this.LaunchType, ECSDefinedCommandOptions.ARGUMENT_LAUNCH_TYPE, false));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_LAUNCH_SUBNETS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.SubnetIds, ECSDefinedCommandOptions.ARGUMENT_LAUNCH_SUBNETS, false)));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_LAUNCH_SECURITYGROUPS.ConfigFileKey, ECSToolsDefaults.FormatCommaDelimitedList(command.GetStringValuesOrDefault(this.SecurityGroupIds, ECSDefinedCommandOptions.ARGUMENT_LAUNCH_SECURITYGROUPS, false)));
     data.SetIfNotNull(ECSDefinedCommandOptions.ARGUMENT_LAUNCH_ASSIGN_PUBLIC_IP.ConfigFileKey, command.GetBoolValueOrDefault(this.AssignPublicIpAddress, ECSDefinedCommandOptions.ARGUMENT_LAUNCH_ASSIGN_PUBLIC_IP, false));
 }