Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
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> >();
        }
Ejemplo n.º 3
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> >();
        }
        private static async Task <ITenant> CreateDelegatedTenant(this ITenantStore tenantStore, ITenant accessingTenant, ITenant serviceTenant, ILogger?logger = null)
        {
            string delegatedTenantName = TenantNames.DelegatedTenant(serviceTenant.Name, accessingTenant.Name);

            logger?.LogDebug("Creating new delegated tenant '{delegatedTenantName}'", delegatedTenantName);
            ITenant delegatedTenant = await tenantStore.CreateChildTenantAsync(serviceTenant.Id, delegatedTenantName).ConfigureAwait(false);

            logger?.LogDebug(
                "New delegated tenant '{delegatedTenantName}' created with Id '{tenantId}'; updating tenant type.",
                delegatedTenant.Name,
                delegatedTenant.Id);

            delegatedTenant = await tenantStore.UpdateTenantAsync(
                delegatedTenant.Id,
                propertiesToSetOrAdd : PropertyBagValues.Build(p => p.AddMarainTenantType(MarainTenantType.Delegated)))
                              .ConfigureAwait(false);

            logger?.LogInformation(
                "Created new delegated tenant '{delegatedTenantName}' with Id '{tenantId}'.",
                delegatedTenant.Name,
                delegatedTenant.Id);
            return(delegatedTenant);
        }