Beispiel #1
0
        public AddSchema() : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Schema name. Recomended to use same domain name but not in plural. The name will be converted to PascalCase", "n", string.Empty);

            DomainParameter = new ActionParameterDefinition(
                "domain", ActionParameterDefinition.TypeValue.String, "Domain name", "d", string.Empty)
            {
                IsDomainSuggestion = true,
            };

            HasStateParameter = new ActionParameterDefinition(
                "hasstate", ActionParameterDefinition.TypeValue.Boolean, "The new schema has state. It will add 'State' attribute with values 1 enbled, 0 disabled. Default value = false", "s", false);

            HasUserRelationshipParameter = new ActionParameterDefinition(
                "hasuserrelationship", ActionParameterDefinition.TypeValue.Boolean, "The new schema has user relationship. It will add 'CreatedBy' and 'ModifiedBy' forening keys to the schema, related with 'User' schema (must be created first). Default value = false", "u", false);

            HasOwnerParameter = new ActionParameterDefinition(
                "hasowner", ActionParameterDefinition.TypeValue.Boolean, "The new schema has owner. It will add 'Owner'. Default value = false", "o", false);


            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(DomainParameter);
            ActionParametersDefinition.Add(HasStateParameter);
            ActionParametersDefinition.Add(HasOwnerParameter);
            ActionParametersDefinition.Add(HasUserRelationshipParameter);
        }
Beispiel #2
0
        public ModifySchema() : base(ActionName)
        {
            SchemaNameParameter = new ActionParameterDefinition(
                "schemaname", ActionParameterDefinition.TypeValue.String, "Domain name", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            AddIdParameter = new ActionParameterDefinition(
                "addid", ActionParameterDefinition.TypeValue.Boolean, "Add id to the schema. It will add 'Id' attribute with GUID and primary key. Default value = false", "i", false);

            AddStateParameter = new ActionParameterDefinition(
                "addstate", ActionParameterDefinition.TypeValue.Boolean, "Add state to the schema. It will add 'State' attribute with values 1 enbled, 0 disabled. Default value = false", "st", false);

            AddUserRelationshipParameter = new ActionParameterDefinition(
                "adduserrelationship", ActionParameterDefinition.TypeValue.Boolean, "Add user relationships to schema. It will add 'CreatedBy' and 'ModifiedBy' forening keys to the schema, related with 'User' schema (must be created first). Default value = false", "u", false);

            AddDatesParameter = new ActionParameterDefinition(
                "adddates", ActionParameterDefinition.TypeValue.Boolean, "Add dates to schema. It will add 'CreatedOn' and 'ModifiedOn' of DateTime type. Default value = false", "d", false);

            AddOwnerParameter = new ActionParameterDefinition(
                "addowner", ActionParameterDefinition.TypeValue.Boolean, "Add owner to schema. It will add 'Owner'. Default value = false", "o", false);

            ActionParametersDefinition.Add(SchemaNameParameter);
            ActionParametersDefinition.Add(AddIdParameter);
            ActionParametersDefinition.Add(AddDatesParameter);
            ActionParametersDefinition.Add(AddStateParameter);
            ActionParametersDefinition.Add(AddOwnerParameter);
            ActionParametersDefinition.Add(AddUserRelationshipParameter);
        }
Beispiel #3
0
        public DeleteGithubSetting() : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Name", "n", string.Empty);

            ActionParametersDefinition.Add(NameParameter);
        }
Beispiel #4
0
        public AddDomain() : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Domain name. Must be unique. Is mandatory to use PascalCase for the name. Otherwise the name will be converterd", "n", string.Empty);

            ActionParametersDefinition.Add(NameParameter);
        }
Beispiel #5
0
        public AddUseCase() : base(ActionName)
        {
            SchemaNameParameter = new ActionParameterDefinition(
                "schema", ActionParameterDefinition.TypeValue.String, "Schema name", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            UseCaseParameter = new ActionParameterDefinition(
                "usecase", ActionParameterDefinition.TypeValue.String, "Use case", "u", string.Empty)
            {
                InputSuggestions = UseCase.GetUseCaseTypesList()
            };

            IntersectionDomainParameter = new ActionParameterDefinition(
                "intersectionschema", ActionParameterDefinition.TypeValue.String, "If use case = RetrieveMultipleIntersection, indicate the intersection schema", "i", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            NeedsAthorizationParameter = new ActionParameterDefinition(
                "authorization", ActionParameterDefinition.TypeValue.Boolean, "Access to this use case needs user-authorization. Default value = false", "a", false);

            ActionParametersDefinition.Add(NeedsAthorizationParameter);
            ActionParametersDefinition.Add(UseCaseParameter);
            ActionParametersDefinition.Add(SchemaNameParameter);
            ActionParametersDefinition.Add(IntersectionDomainParameter);
        }
Beispiel #6
0
 public DeleteEnvironment() : base(ActionName)
 {
     NameParameter = new ActionParameterDefinition(
         "name", ActionParameterDefinition.TypeValue.String, "Evironment name", "n", string.Empty)
     {
         IsEnvironmentSuggestion = true
     };
     ActionParametersDefinition.Add(NameParameter);
 }
Beispiel #7
0
        public AddSetting() : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Setting name", "n", string.Empty)
            {
                InputSuggestions = Definitions.Settings.ToList()
            };
            ValueParameter = new ActionParameterDefinition(
                "value", ActionParameterDefinition.TypeValue.String, "Value for the setting", "v", string.Empty);

            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(ValueParameter);
        }
Beispiel #8
0
        public AddEnvironment() : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Evironment name", "n", string.Empty);
            ShortNameParameter = new ActionParameterDefinition(
                "shortname", ActionParameterDefinition.TypeValue.String, "Shortname. Will be used for name the pipelines and branchs. In LowerCase", "s", string.Empty);
            OrderParameter = new ActionParameterDefinition(
                "order", ActionParameterDefinition.TypeValue.Integer, "Order", "n", 1);

            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(ShortNameParameter);
            ActionParametersDefinition.Add(OrderParameter);
        }
Beispiel #9
0
        public AddSchemaView() : base(ActionName)
        {
            SchemaNameParameter = new ActionParameterDefinition(
                "schemaname", ActionParameterDefinition.TypeValue.String, "Schema name", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };
            SchemaNameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "View name. The name will be completed with format. The name will be coverted to CamelCase. Example of name: GetActiveEntities, GetXEntities", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            ActionParametersDefinition.Add(SchemaNameParameter);
        }
Beispiel #10
0
        public AddGithubSetting(ICryptoService cryptoService) : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Name", "n", string.Empty);
            OAuthTokenKeyParameter = new ActionParameterDefinition(
                "oauthtokenkey", ActionParameterDefinition.TypeValue.Password, "Oauth token key for access", "t", string.Empty);
            UriParameter = new ActionParameterDefinition(
                "uri", ActionParameterDefinition.TypeValue.String, "Github URI. Use https://github.com/", "u", string.Empty);

            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(OAuthTokenKeyParameter);
            ActionParametersDefinition.Add(UriParameter);
            CryptoService = cryptoService ?? throw new ArgumentNullException(nameof(cryptoService));

            RegisterDeployActions();
        }
Beispiel #11
0
        public DeleteSchema() : base(ActionName)
        {
            DomainParameter = new ActionParameterDefinition(
                "domain", ActionParameterDefinition.TypeValue.String, "Domain", "d", string.Empty)
            {
                IsDomainSuggestion = true
            };

            SchemaNameParameter = new ActionParameterDefinition(
                "schemaname", ActionParameterDefinition.TypeValue.String, "Schema name", "s", string.Empty)
            {
                InputSuggestionsHandler = GetDomainSchemasSuggestionHandler
            };

            ActionParametersDefinition.Add(DomainParameter);
            ActionParametersDefinition.Add(SchemaNameParameter);
        }
Beispiel #12
0
        public AddAzurePipelinesSetting(ICryptoService cryptoService) : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Name", "n", string.Empty);
            OrganizationUriParameter = new ActionParameterDefinition(
                "organizationuri", ActionParameterDefinition.TypeValue.String, "Organization URI. Use https://xxxxx.visualstudio.com/", "o", string.Empty);
            TokenParameter = new ActionParameterDefinition(
                "token", ActionParameterDefinition.TypeValue.Password, "Token for access", "t", string.Empty);
            //ProjectIdParameter = new ActionParameterDefinition(
            //    "projectid", ActionParameterDefinition.TypeValue.String, "Azure pipelines project id", "p", Guid.Empty.ToString());

            ActionParametersDefinition.Add(NameParameter);
            //ActionParametersDefinition.Add(ProjectIdParameter);
            ActionParametersDefinition.Add(OrganizationUriParameter);
            ActionParametersDefinition.Add(TokenParameter);
            CryptoService = cryptoService ?? throw new ArgumentNullException(nameof(cryptoService));
        }
Beispiel #13
0
        public void ExecuteHelp()
        {
            var data = new StringBuilder();

            data.AppendLine($"# Action Name: {Name}");
            data.AppendLine($"# Invocation Name: {GetInvocationCommandName()}");
            data.AppendLine($"# Description: {Description}");
            data.AppendLine(
                ActionParametersDefinition.ToDisplayList(
                    item => {
                StringBuilder line = new StringBuilder();
                line.Append($"--{item.Name}");
                if (item.ShortCut != null)
                {
                    line.Append($" [-{item.ShortCut}]");
                }
                line.Append($", Type value: {item.Type.ToString()}, Description: {item.Description}");
                return(line.ToString());
            }, "Parameters:", ""));
            Log(data.ToString());
        }
Beispiel #14
0
        public AddSchemaIntersection() : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Schema name. Recomended to use same domain name but not in plural. The name will be converted to PascalCase", "n", string.Empty);

            FirstSchemaNameParameter = new ActionParameterDefinition(
                "firstdomain", ActionParameterDefinition.TypeValue.String, "First domain name intersection", "f", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            SecondSchemaNameParameter = new ActionParameterDefinition(
                "seconddomain", ActionParameterDefinition.TypeValue.String, "Second domain name intersection", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(FirstSchemaNameParameter);
            ActionParametersDefinition.Add(SecondSchemaNameParameter);
        }
Beispiel #15
0
        public InitializeProject(
            IFileService fileService,
            IGithubClientService githubClientService,
            IGitClientService gitClientService,
            IDotnetService dotnetService,
            IDDService dDService) : base(ActionName)
        {
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Domain name. Must be unique. Is mandatory to use PascalCase for the name. Otherwise the name will be converterd", "n", string.Empty);
            NamespaceParameter = new ActionParameterDefinition(
                "namespace", ActionParameterDefinition.TypeValue.String, "Namespace. Is mandatory to use My.Domain.Project.Convention for your namespace. Otherwise the namespace will be converterd", "s", string.Empty);
            ProjectPathParameter = new ActionParameterDefinition(
                "projectpath", ActionParameterDefinition.TypeValue.String, "Path for locate the project files", "p", string.Empty);

            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(NamespaceParameter);
            ActionParametersDefinition.Add(ProjectPathParameter);
            FileService         = fileService ?? throw new ArgumentNullException(nameof(fileService));
            GithubClientService = githubClientService ?? throw new ArgumentNullException(nameof(githubClientService));
            GitClientService    = gitClientService ?? throw new ArgumentNullException(nameof(gitClientService));
            DotnetService       = dotnetService ?? throw new ArgumentNullException(nameof(dotnetService));
            DDService           = dDService ?? throw new ArgumentNullException(nameof(dDService));
        }
Beispiel #16
0
        public bool IsParamOk(List <ActionParameter> parameters, string name)
        {
            var paremeterDefinition = ActionParametersDefinition
                                      .FirstOrDefault(k => k.Name == name);

            if (paremeterDefinition == null)
            {
                throw new KeyNotFoundException($"Parameter with name '{name}' doesnt exist in the definition of '{Name}'");
            }
            var parameter = parameters.FirstOrDefault(k => k.ParameterName == name);

            if (parameter != null)
            {
                if (paremeterDefinition.Type == ActionParameterDefinition.TypeValue.Boolean)
                {
                    return(true);
                }
                else if (paremeterDefinition.Type == ActionParameterDefinition.TypeValue.Decimal)
                {
                    return(true);
                }
                else if (paremeterDefinition.Type == ActionParameterDefinition.TypeValue.Integer)
                {
                    return(true);
                }
                else if (paremeterDefinition.Type == ActionParameterDefinition.TypeValue.String)
                {
                    return(!string.IsNullOrEmpty(parameter.ValueString));
                }
                else if (paremeterDefinition.Type == ActionParameterDefinition.TypeValue.Password)
                {
                    return(!string.IsNullOrEmpty(parameter.ValueString));
                }
            }
            return(false);
        }
Beispiel #17
0
        public DeleteUseCase() : base(ActionName)
        {
            SchemaNameParameter = new ActionParameterDefinition(
                "schema", ActionParameterDefinition.TypeValue.String, "Schema name", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            UseCaseParameter = new ActionParameterDefinition(
                "usecase", ActionParameterDefinition.TypeValue.String, "Use case", "u", string.Empty)
            {
                InputSuggestions = UseCase.GetUseCaseTypesList()
            };

            IntersectionSchemaParameter = new ActionParameterDefinition(
                "intersectiondomain", ActionParameterDefinition.TypeValue.String, "If use case = RetrieveMultipleIntersection, indicate the intersection domain", "i", string.Empty)
            {
                IsSchemaSuggestion = true
            };

            ActionParametersDefinition.Add(UseCaseParameter);
            ActionParametersDefinition.Add(SchemaNameParameter);
            ActionParametersDefinition.Add(IntersectionSchemaParameter);
        }
Beispiel #18
0
        public AddSchemaProperty() : base(ActionName)
        {
            SchemaNameParameter = new ActionParameterDefinition(
                "schemaname", ActionParameterDefinition.TypeValue.String, "Schema name", "s", string.Empty)
            {
                IsSchemaSuggestion = true
            };
            NameParameter = new ActionParameterDefinition(
                "name", ActionParameterDefinition.TypeValue.String, "Name. Use PascalCase or the name will be converted to PascalCase automatically", "n", string.Empty);
            TypeParameter = new ActionParameterDefinition(
                "type", ActionParameterDefinition.TypeValue.String, "Type. Possible values: Guid = 1, Boolean = 2, Integer = 3, Decimal = 4,  Float = 5, Time = 6, DateTime = 7, String = 8, LongString = 9, Password = 99, ",
                "t", string.Empty)
            {
                InputSuggestions = SchemaProperty.GetUseCaseTypesList()
            };

            LengthParameter = new ActionParameterDefinition(
                "length", ActionParameterDefinition.TypeValue.Integer, "Length. Use only for String types", "l", 0);
            IsPrimaryKeyParameter = new ActionParameterDefinition(
                "primarykey", ActionParameterDefinition.TypeValue.Boolean, "Is primary key", "pk", false);
            IsNullableParameter = new ActionParameterDefinition(
                "nullable", ActionParameterDefinition.TypeValue.Boolean, "Is nullable", "nl", false);
            IsUniqueParameter = new ActionParameterDefinition(
                "unique", ActionParameterDefinition.TypeValue.Boolean, "Is unique key", "un", false);
            IsAutoIncrementalParameter = new ActionParameterDefinition(
                "autoincrement", ActionParameterDefinition.TypeValue.Boolean, "Is autoincrement. Only valid for Integer types", "ai", false);

            ActionParametersDefinition.Add(SchemaNameParameter);
            ActionParametersDefinition.Add(NameParameter);
            ActionParametersDefinition.Add(TypeParameter);
            ActionParametersDefinition.Add(LengthParameter);
            ActionParametersDefinition.Add(IsPrimaryKeyParameter);
            ActionParametersDefinition.Add(IsNullableParameter);
            ActionParametersDefinition.Add(IsUniqueParameter);
            ActionParametersDefinition.Add(IsAutoIncrementalParameter);
        }
Beispiel #19
0
        public void ImplementHelpCommand()
        {
            var helpCommand = new ActionParameterDefinition("help", ActionParameterDefinition.TypeValue.Boolean, "Details about the command and it's available parameters", "h", false);

            ActionParametersDefinition.Add(helpCommand);
        }
Beispiel #20
0
 public DeleteAzurePipelinesSetting() : base(ActionName)
 {
     NameParameter = new ActionParameterDefinition(
         "name", ActionParameterDefinition.TypeValue.String, "Name", "o", string.Empty);
     ActionParametersDefinition.Add(NameParameter);
 }