Пример #1
0
 public DeploymentActionResource ClearAllConditions()
 {
     Channels.Clear();
     Environments.Clear();
     TenantTags.Clear();
     return(this);
 }
Пример #2
0
 public MachineResource AddOrUpdateTenantTags(params TagResource[] tenantTags)
 {
     foreach (var tenantTag in tenantTags)
     {
         TenantTags.Add(tenantTag.CanonicalTagName);
     }
     return(this);
 }
Пример #3
0
        public TenantResource WithTag(TagResource tag)
        {
            if (!TenantTags.Any(t => string.Equals(t, tag.CanonicalTagName, StringComparison.OrdinalIgnoreCase)))
            {
                TenantTags.Add(tag.CanonicalTagName);
            }

            return(this);
        }
Пример #4
0
        void ValidateTenantTags(IOctopusSpaceRepository repository)
        {
            if (TenantTags == null || !TenantTags.Any())
            {
                return;
            }

            var tagSets     = repository.TagSets.FindAll();
            var missingTags = TenantTags.Where(tt => !tagSets.Any(ts => ts.Tags.Any(t => t.CanonicalTagName.Equals(tt, StringComparison.OrdinalIgnoreCase)))).ToList();

            if (missingTags.Any())
            {
                throw new ArgumentException(CouldNotFindMessage("tag", missingTags.ToArray()));
            }
        }
Пример #5
0
        void ValidateTenantTags(OctopusRepository repository)
        {
            if (TenantTags == null || !TenantTags.Any())
            {
                return;
            }

            var tagSets     = repository.TagSets.FindAll();
            var missingTags = TenantTags.Where(tt => !tagSets.Any(ts => ts.Tags.Any(t => t.CanonicalTagName.Equals(tt, StringComparison.OrdinalIgnoreCase)))).ToList();

            if (missingTags.Any())
            {
                throw new ArgumentException($"Could not find the {"tag" + (missingTags.Count == 1 ? "" : "s")} {string.Join(", ", missingTags)} on the Octopus server.");
            }
        }
Пример #6
0
        public DeleteAutoDeployOverrideCommand(IOctopusAsyncRepositoryFactory repositoryFactory, ILogger log, IOctopusFileSystem fileSystem, IOctopusClientFactory octopusClientFactory) :
            base(octopusClientFactory, repositoryFactory, log, fileSystem)
        {
            var options = Options.For("Delete auto deploy release override");

            options.Add("project=", "Name of the project", v => ProjectName = v);
            options.Add("environment=",
                        "Name of an environment the override will apply to. Specify this argument multiple times to add multiple environments.",
                        v => EnvironmentNames.Add(v));
            options.Add("tenant=",
                        "[Optional] Name of a tenant the override will apply to. Specify this argument multiple times to add multiple tenants or use `*` wildcard for all tenants.",
                        t => TenantNames.Add(t));
            options.Add("tenanttag=",
                        "[Optional] A tenant tag used to match tenants that the override will apply to. Specify this argument multiple times to add multiple tenant tags",
                        tt => TenantTags.Add(tt));
        }
        async Task ValidateTenantTags(IOctopusSpaceAsyncRepository repository)
        {
            if (TenantTags == null || !TenantTags.Any())
            {
                return;
            }

            var tagSets = await repository.TagSets.FindAll().ConfigureAwait(false);

            var missingTags = TenantTags.Where(tt => !tagSets.Any(ts => ts.Tags.Any(t => t.CanonicalTagName.Equals(tt, StringComparison.OrdinalIgnoreCase)))).ToList();

            if (missingTags.Any())
            {
                throw new InvalidRegistrationArgumentsException(CouldNotFindMessage("tag", missingTags.ToArray()));
            }
        }
Пример #8
0
        public DeleteAutoDeployOverrideCommand(IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, IOctopusClientFactory octopusClientFactory, ICommandOutputProvider commandOutputProvider) :
            base(octopusClientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("Delete auto deploy release override");

            options.Add("project=", "Name of the project", v => ProjectName = v);
            options.Add("environment=",
                        "Name of an environment the override will apply to. Specify this argument multiple times to add multiple environments.",
                        v => EnvironmentNames.Add(v));
            options.Add("tenant=",
                        "[Optional] Name of a tenant the override will apply to. Specify this argument multiple times to add multiple tenants or use `*` wildcard for all tenants.",
                        t => TenantNames.Add(t));
            options.Add("tenanttag=",
                        "[Optional] A tenant tag used to match tenants that the override will apply to. Specify this argument multiple times to add multiple tenant tags",
                        tt => TenantTags.Add(tt));

            deletedDeplomentOverrides = new List <Tuple <EnvironmentResource, TenantResource, DeletedOutcome> >();
        }
Пример #9
0
        public CreateAutoDeployOverrideCommand(IOctopusAsyncRepositoryFactory repositoryFactory, IOctopusFileSystem fileSystem, IOctopusClientFactory clientFactory, ICommandOutputProvider commandOutputProvider) :
            base(clientFactory, repositoryFactory, fileSystem, commandOutputProvider)
        {
            var options = Options.For("Auto deploy release override");

            options.Add <string>("project=", "Name of the project.", v => ProjectName = v);
            options.Add <string>("environment=",
                                 "Name of an environment the override will apply to. Specify this argument multiple times to add multiple environments.",
                                 v => EnvironmentNames.Add(v), allowsMultiple: true);
            options.Add <string>("version=|releaseNumber=", "Release number to use for auto deployments.",
                                 v => ReleaseVersionNumber = v);
            options.Add <string>("tenant=",
                                 "[Optional] Name of a tenant the override will apply to. Specify this argument multiple times to add multiple tenants or use `*` wildcard for all tenants.",
                                 t => TenantNames.Add(t), allowsMultiple: true);
            options.Add <string>("tenantTag=",
                                 "[Optional] A tenant tag used to match tenants that the override will apply to. Specify this argument multiple times to add multiple tenant tags",
                                 tt => TenantTags.Add(tt), allowsMultiple: true);

            createdDeploymentOverides = new List <Tuple <EnvironmentResource, TenantResource, CreatedOutcome> >();
        }
Пример #10
0
 public TenantResource ClearTags()
 {
     TenantTags.Clear();
     return(this);
 }
Пример #11
0
 public MachineResource ClearTenantTags()
 {
     TenantTags.Clear();
     return(this);
 }
Пример #12
0
 public MachineResource RemoveTenantTag(TagResource tenantTag)
 {
     TenantTags.Remove(tenantTag.CanonicalTagName);
     return(this);
 }
 public DeploymentActionResource ForTenantTags(params TagResource[] tags)
 {
     TenantTags.ReplaceAll(tags.Select(t => t.CanonicalTagName));
     return(this);
 }