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

            return(this);
        }
Example #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()));
            }
        }
Example #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.");
            }
        }
Example #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()));
            }
        }
Example #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> >();
        }
Example #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> >();
        }
 public TenantResource ClearTags()
 {
     TenantTags.Clear();
     return(this);
 }
Example #11
0
 public MachineResource ClearTenantTags()
 {
     TenantTags.Clear();
     return(this);
 }
Example #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);
 }