コード例 #1
0
        internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var context = await Context
                          .WithDevOpsLogon()
                          .BuildAsync(cancellationToken);

            context.ResourceGroupDeprecationCheck(this.ResourceGroup);
            if (string.IsNullOrEmpty(Instance) &&
                string.IsNullOrEmpty(Project))
            {
                context.Logger.WriteError("Specify at least one filtering parameter.");
                return(ExitCodes.InvalidArguments);
            }
            var instance = string.IsNullOrEmpty(Instance) ? null : context.Naming.Instance(Instance, ResourceGroup);
            // HACK we pass null as the next calls do not use the Azure connection
            var  mappings = new AggregatorMappings(context.Devops, null, context.Logger, context.Naming);
            bool any      = false;

            cancellationToken.ThrowIfCancellationRequested();
            foreach (var item in await mappings.ListAsync(instance, Project))
            {
                context.Logger.WriteOutput(item);
                any = true;
            }
            if (!any)
            {
                context.Logger.WriteInfo("No rule mappings found.");
                return(ExitCodes.NotFound);
            }
            else
            {
                return(ExitCodes.Success);
            }
        }
コード例 #2
0
        internal override async Task <int> RunAsync()
        {
            var context = await Context
                          .WithVstsLogon()
                          .Build();

            var  instance = new InstanceName(Instance);
            var  mappings = new AggregatorMappings(context.Vsts, /*HACK*/ null, context.Logger);
            bool any      = false;

            foreach (var item in await mappings.ListAsync(instance))
            {
                context.Logger.WriteOutput(
                    item,
                    (data) => $"Project {item.project} invokes rule {instance.PlainName}/{item.rule} for {item.@event}");
                any = true;
            }
            if (!any)
            {
                context.Logger.WriteInfo("No rule mappings found.");
            }
            return(0);
        }
コード例 #3
0
        internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var context = await Context
                          .WithDevOpsLogon()
                          .BuildAsync(cancellationToken);

            var instance = string.IsNullOrEmpty(Instance) ? null : new InstanceName(Instance, ResourceGroup);
            // HACK we pass null as the next calls do not use the Azure connection
            var  mappings = new AggregatorMappings(context.Devops, null, context.Logger);
            bool any      = false;

            cancellationToken.ThrowIfCancellationRequested();
            foreach (var item in await mappings.ListAsync(instance, Project))
            {
                context.Logger.WriteOutput(item);
                any = true;
            }
            if (!any)
            {
                context.Logger.WriteInfo("No rule mappings found.");
            }
            return(0);
        }
コード例 #4
0
        internal override async Task <int> RunAsync()
        {
            var context = await Context
                          .WithDevOpsLogon()
                          .Build();

            var instance = string.IsNullOrEmpty(Instance) ? null : new InstanceName(Instance, ResourceGroup);
            // HACK we pass null as the next calls do not use the Azure connection
            var  mappings = new AggregatorMappings(context.Devops, null, context.Logger);
            bool any      = false;

            foreach (var item in await mappings.ListAsync(instance, Project))
            {
                context.Logger.WriteOutput(
                    item,
                    (data) => $"Project {item.project} invokes rule {item.rule} for {item.@event} (status {item.status})");
                any = true;
            }
            if (!any)
            {
                context.Logger.WriteInfo("No rule mappings found.");
            }
            return(0);
        }