コード例 #1
0
 public NautilusService(IOctopusRepository octopusRepository, TextWriter log = null)
 {
     if (octopusRepository == null) throw new ArgumentNullException(nameof(octopusRepository));
     
     Octopus = new OctopusProxy(octopusRepository);
     Log = log ?? TextWriter.Null;
 }
コード例 #2
0
ファイル: ApiCommand.cs プロジェクト: ShawInnes/Octopus-Tools
        public void Execute(string[] commandLineArguments)
        {
            var remainingArguments = optionGroups.Parse(commandLineArguments);
            if (remainingArguments.Count > 0)
                throw new CommandException("Unrecognized command arguments: " + string.Join(", ", remainingArguments));

            if (string.IsNullOrWhiteSpace(serverBaseUrl))
                throw new CommandException("Please specify the Octopus Server URL using --server=http://your-server/");

            if (string.IsNullOrWhiteSpace(apiKey))
                throw new CommandException("Please specify your API key using --apiKey=ABCDEF123456789. Learn more at: https://github.com/OctopusDeploy/Octopus-Tools");

            var credentials = ParseCredentials(username, password);

            var endpoint = new OctopusServerEndpoint(serverBaseUrl, apiKey, credentials);

            repository = repositoryFactory.CreateRepository(endpoint);

            if (enableDebugging)
            {
                repository.Client.SendingOctopusRequest += request => log.Debug(request.Method + " " + request.Uri);
            }

            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) =>
            {
                if (errors == SslPolicyErrors.None)
                {
                    return true;
                }

                var certificate2 = (X509Certificate2) certificate;
                var warning = "The following certificate errors were encountered when establishing the HTTPS connection to the server: " + errors + Environment.NewLine +
                                 "Certificate subject name: " + certificate2.SubjectName.Name + Environment.NewLine +
                                 "Certificate thumbprint:   " + ((X509Certificate2) certificate).Thumbprint;

                if (ignoreSslErrors)
                {
                    log.Warn(warning);
                    log.Warn("Because --ignoreSslErrors was set, this will be ignored.");
                    return true;
                }

                log.Error(warning);
                return false;
            };

            log.Debug("Handshaking with Octopus server: " + serverBaseUrl);
            var root = repository.Client.RootDocument;
            log.Debug("Handshake successful. Octopus version: " + root.Version + "; API version: " + root.ApiVersion);

            var user = repository.Users.GetCurrent();
            if (user != null)
            {
                log.DebugFormat("Authenticated as: {0} <{1}> {2}", user.DisplayName, user.EmailAddress, user.IsService ? "(a service account)" : "");
            }

            Execute();
        }
コード例 #3
0
 public OctopusDeploy(string machineName, ConfigSettings config, IOctopusRepository repository, IProcessRunner processRunner, IRegistryEditor registryEditor)
 {
     _machineName = machineName;
     _config = config;
     _processRunner = processRunner;
     _registryEditor = registryEditor;
     _repository = repository;
     _tentacleInstallPath = _config.TentacleInstallPath;
     _tentaclePath = Path.Combine(_tentacleInstallPath, "Tentacle", "Tentacle.exe");
 }
コード例 #4
0
        private VariableSetResource GetVariables(IOctopusRepository octopus)
        {
            // Find the project that owns the variables we want to edit
              var project = octopus.Projects.FindByName(_args.Project);

              var variableSetLink = project != null
              ? project.Link("Variables")
              : octopus.LibraryVariableSets.FindOne(f => f.Name == _args.Project).Link("Variables");

              return octopus.VariableSets.Get(variableSetLink);
        }
コード例 #5
0
ファイル: UseVariableSet.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);
            // Find the project that owns the variables we want to edit
            _project = _octopus.Projects.FindByName(Project);

            if (_project == null)
                throw new Exception(string.Format("Project '{0}' was not found.", Project));

            WriteDebug("Found project" + _project.Id);
        }
コード例 #6
0
        public IImporter Find(string name, IOctopusRepository repository, IOctopusFileSystem fileSystem, ILog log)
        {
            name = name.Trim().ToLowerInvariant();
            var found = (from t in typeof (ImporterLocator).Assembly.GetTypes()
                where typeof (IImporter).IsAssignableFrom(t)
                let attribute = (IImporterMetadata) t.GetCustomAttributes(typeof (ImporterAttribute), true).FirstOrDefault()
                where attribute != null
                where attribute.Name == name
                select t).FirstOrDefault();

            return found == null ? null : (IImporter) lifetimeScope.Resolve(found, new TypedParameter(typeof (IOctopusRepository), repository), new TypedParameter(typeof (IOctopusFileSystem), fileSystem), new TypedParameter(typeof (ILog), log));
        }
コード例 #7
0
    public void Load(IPortalApplication portalApplication)
    {
      PortalApplication = portalApplication;
      PortalApplication.Bindings.Add(typeof (Extension.Dto.Job), new JobParameterBinding());

      var module = PortalApplication.PortalRepository.ModuleGet("Octopus");
      var config = OctopusConfig.Create(module);

      OctopusRepository = new OctopusRepository(config.ConnectionString);

			portalApplication.MapRoute("/v6/Job", () => new Job(portalApplication, OctopusRepository));
      portalApplication.MapRoute("/v6/Heartbeat", () => new Heartbeat(portalApplication, OctopusRepository.Heartbeat));
      portalApplication.AddBinding(typeof(ClusterState), new JsonParameterBinding<ClusterState>());
    }
コード例 #8
0
        public void Render(IOctopusRepository repository, ILog log, TaskResource resource)
        {
            var details = repository.Tasks.GetDetails(resource);

            if (details.ActivityLog != null)
            {
                foreach (var item in details.ActivityLog.Children)
                {
                    if (log.ServiceMessagesEnabled())
                    {
                        RenderToTeamCity(item, log);
                    }
                    else
                    {
                        RenderToConsole(item, log, "");                        
                    }
                }
            }
        }
コード例 #9
0
 public static IOctopusSpaceRepository ForSpace(this IOctopusRepository repo, SpaceResource space)
 {
     return(repo.Client.ForSpace(space));
 }
コード例 #10
0
 public MachineRepository(IOctopusRepository repository) : base(repository, "Machines")
 {
 }
コード例 #11
0
 /// <summary>
 /// BeginProcessing
 /// </summary>
 protected override void BeginProcessing()
 {
     _octopus = Session.RetrieveSession(this);
 }
コード例 #12
0
ファイル: CopyStep.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            // Find the project that owns the variables we want to get
            var project = _octopus.Projects.FindByName(Project);

            if (project == null)
            {
                const string msg = "Project '{0}' was not found.";
                throw new Exception(string.Format(msg, Project));
            }

            var id = project.DeploymentProcessId;
            _deploymentProcess = _octopus.DeploymentProcesses.Get(id);

            var steps = from s in _deploymentProcess.Steps
                        where s.Name.Equals(Name, StringComparison.InvariantCultureIgnoreCase)
                        select s;

            _step = steps.FirstOrDefault();

            if (_step == null)
                throw new Exception(string.Format("Step with name '{0}' was not found.", Name));
        }
コード例 #13
0
 public EnvironmentRepository(IOctopusRepository repository)
     : base(repository, "Environments")
 {
 }
コード例 #14
0
ファイル: UpdateVariable.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            WriteDebug("Got connection");

            // Find the project that owns the variables we want to edit
            var project = _octopus.Projects.FindByName(Project);

            if (project == null)
            {
                const string msg = "Project '{0}' was not found.";
                throw new Exception(string.Format(msg, Project));
            }

            WriteDebug("Found project" + project.Id);

            // Get the variables for editing
            _variableSet = _octopus.VariableSets.Get(project.Link("Variables"));

            WriteDebug("Found variable set" + _variableSet.Id);
        }
コード例 #15
0
ファイル: GetStep.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            WriteDebug("Connection established");

            switch (ParameterSetName)
            {
                case "ByProjectName":
                    _projects = _octopus.Projects.FindByNames(Project);
                    break;
                case "ByProjectId":
                    LoadProjectsByIds();
                    break;
                case "ByDeploymentProcessId":
                    break;
                default:
                    throw new Exception("Unknown ParameterSetName: " + ParameterSetName);
            }
        }
コード例 #16
0
 public static ProjectChannel ToModel(this ChannelResource resource, IOctopusRepository repository)
 {
     return(new ProjectChannel(new ElementIdentifier(resource.Name), resource.Description, resource.IsDefault));
 }
コード例 #17
0
 public TeamsRepository(IOctopusRepository repository)
     : base(repository, "Teams")
 {
     MinimumCompatibleVersion("2019.1.0");
 }
コード例 #18
0
ファイル: GetProject.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            // FIXME: Loading all the projects when you might only
            // be looking for one, isn't exactly efficient

            if (!Cache || Utilities.Cache.Projects.IsExpired)
                _projects = _octopus.Projects.FindAll();

            if (Cache)
            {
                if (Utilities.Cache.Projects.IsExpired)
                    Utilities.Cache.Projects.Set(_projects);
                else
                    _projects = Utilities.Cache.Projects.Values;
            }

            WriteDebug("Loaded projects");
        }
コード例 #19
0
 public ProjectExporter(IOctopusRepository repository, IOctopusFileSystem fileSystem, ILogger log)
     : base(repository, fileSystem, log)
 {
     actionTemplateRepository = new ActionTemplateRepository(repository.Client);
 }
コード例 #20
0
        public static LibraryVariableSet ToModel(this LibraryVariableSetResource resource, IOctopusRepository repository)
        {
            var variableSetResource = repository.VariableSets.Get(resource.VariableSetId);

            return(new LibraryVariableSet(
                       new ElementIdentifier(resource.Name),
                       resource.Description,
                       (LibraryVariableSet.VariableSetContentType)resource.ContentType,
                       variableSetResource.Variables.Select(v => v.ToModel(null, repository))));
        }
コード例 #21
0
 public ScopedUserRoleRepository(IOctopusRepository repository)
     : base(repository, "ScopedUserRoles")
 {
     MinimumCompatibleVersion("2019.1.0");
 }
コード例 #22
0
ファイル: AddProject.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            if (ParameterSetName != "ByName") return;

            var projectGroup = _octopus.ProjectGroups.FindByName(ProjectGroupName);
            if (projectGroup == null)
                throw new Exception(string.Format("Project '{0}' was not found.", ProjectGroupName));

            _projectGroupId = projectGroup.Id;
        }
コード例 #23
0
 public static Dictionary <VariableScopeType, IEnumerable <ElementReference> > ToModel(this ScopeSpecification resource, DeploymentProcessResource deploymentProcessResource, IOctopusRepository repository)
 {
     return(resource.ToDictionary(kv => (VariableScopeType)kv.Key,
                                  kv => kv.Value.Select(id => ResolveReference(kv.Key, id, repository, deploymentProcessResource)).ToArray().AsEnumerable()));
 }
コード例 #24
0
 TeamsRepository(IOctopusRepository repository, SpaceContext userDefinedSpaceContext)
     : base(repository, "Teams", userDefinedSpaceContext)
 {
     MinimumCompatibleVersion("2019.1.0");
 }
コード例 #25
0
        private static string ResolveId(VariableScopeType key, ElementReference reference, IOctopusRepository repository, DeploymentProcessResource deploymentProcess, ProjectResource project)
        {
            switch (key)
            {
            case VariableScopeType.Environment:
                return(repository.Environments.ResolveResourceId(reference));

            case VariableScopeType.Machine:
                return(repository.Machines.ResolveResourceId(reference));

            case VariableScopeType.Role:
                return(reference.Name);

            case VariableScopeType.Action:
                return(GetDeploymentAction(deploymentProcess, a => a.Name, reference.Name, nameof(DeploymentActionResource.Name)).Id);

            case VariableScopeType.Channel:
                return(repository.Channels.FindByName(project, reference.Name).Id);

            case VariableScopeType.TenantTag:
                return(reference.Name);

            default:
                throw new InvalidOperationException($"Unsupported ScopeField: {key}");
            }
        }
コード例 #26
0
        public static TenantResource UpdateWith(this TenantResource resource, Tenant model, IOctopusRepository repository)
        {
            resource.Name = model.Identifier.Name;

            resource.TenantTags = new ReferenceCollection(model.TenantTags.Select(x => x.Name));

            resource.ProjectEnvironments.Clear();
            foreach (var projectEnvironment in model.ProjectEnvironments)
            {
                var project = repository.Projects.FindByName(projectEnvironment.Key);
                var envs    = new ReferenceCollection(projectEnvironment.Value.Select(x => repository.Environments.FindByName(x).Id));
                resource.ProjectEnvironments.Add(project.Id, envs);
            }

            return(resource);
        }
コード例 #27
0
 protected BaseImporter(IOctopusRepository repository, IOctopusFileSystem fileSystem, ILog log)
 {
     this.log = log;
     this.repository = repository;
     fileSystemImporter = new FileSystemImporter(fileSystem, log);
 }
        public static Dictionary <string, IEnumerable <string> > ToModel(this IDictionary <string, ReferenceCollection> collection, IOctopusRepository repository)
        {
            var projectEnvs = new Dictionary <string, IEnumerable <string> >();

            foreach (var pe in collection)
            {
                var project = repository.Projects.FindOne(x => x.Id == pe.Key).Name;
                var envs    = pe.Value.Select(e => repository.Environments.FindOne(x => x.Id == e).Name).ToArray();
                projectEnvs.Add(project, envs);
            }

            return(projectEnvs);
        }
コード例 #29
0
ファイル: GetEnvironment.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            WriteDebug("Connection established");

            if (!Cache || Utilities.Cache.Environments.IsExpired)
                _environments = _octopus.Environments.FindAll();

            if (Cache)
            {
                if (Utilities.Cache.Environments.IsExpired)
                    Utilities.Cache.Environments.Set(_environments);
                else
                    _environments = Utilities.Cache.Environments.Values;
            }

            WriteDebug("Loaded environments");
        }
コード例 #30
0
 public ModelUploader(IOctopusRepository repository)
 {
     _repository = repository;
 }
コード例 #31
0
        public OctopusProxy(IOctopusRepository octopusRepository)
        {
            if (octopusRepository == null) throw new ArgumentNullException(nameof(octopusRepository));

            Repository = octopusRepository;
        }
コード例 #32
0
 public MachineRoleRepository(IOctopusRepository repository)
 {
     this.repository = repository;
 }
コード例 #33
0
 public MachinePolicyRepository(IOctopusRepository repository) : base(repository, "MachinePolicies")
 {
 }
コード例 #34
0
 protected BaseExporter(IOctopusRepository repository, IOctopusFileSystem fileSystem, ILog log)
 {
     this.log           = log;
     this.repository    = repository;
     fileSystemExporter = new FileSystemExporter(fileSystem, log);
 }
コード例 #35
0
 public ReleaseExporter(IOctopusRepository repository, IOctopusFileSystem fileSystem, ILog log) :
     base(repository, fileSystem, log)
 {
 }
コード例 #36
0
 public UserRolesRepository(IOctopusRepository repository)
     : base(repository, "UserRoles")
 {
 }
コード例 #37
0
        public void Execute(string[] commandLineArguments)
        {
            var remainingArguments = optionGroups.Parse(commandLineArguments);

            if (remainingArguments.Count > 0)
            {
                throw new CommandException("Unrecognized command arguments: " + string.Join(", ", remainingArguments));
            }

            if (string.IsNullOrWhiteSpace(serverBaseUrl))
            {
                throw new CommandException("Please specify the Octopus Server URL using --server=http://your-server/");
            }

            if (string.IsNullOrWhiteSpace(apiKey))
            {
                throw new CommandException("Please specify your API key using --apiKey=ABCDEF123456789. Learn more at: https://github.com/OctopusDeploy/Octopus-Tools");
            }

            var credentials = ParseCredentials(username, password);

            var endpoint = new OctopusServerEndpoint(serverBaseUrl, apiKey, credentials);

            repository = repositoryFactory.CreateRepository(endpoint);

            if (enableDebugging)
            {
                repository.Client.SendingOctopusRequest += request => log.Debug(request.Method + " " + request.Uri);
            }

            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) =>
            {
                if (errors == SslPolicyErrors.None)
                {
                    return(true);
                }

                var certificate2 = (X509Certificate2)certificate;
                var warning      = "The following certificate errors were encountered when establishing the HTTPS connection to the server: " + errors + Environment.NewLine +
                                   "Certificate subject name: " + certificate2.SubjectName.Name + Environment.NewLine +
                                   "Certificate thumbprint:   " + ((X509Certificate2)certificate).Thumbprint;

                if (ignoreSslErrors)
                {
                    log.Warn(warning);
                    log.Warn("Because --ignoreSslErrors was set, this will be ignored.");
                    return(true);
                }

                log.Error(warning);
                return(false);
            };

            log.Debug("Handshaking with Octopus server: " + serverBaseUrl);
            var root = repository.Client.RootDocument;

            log.Debug("Handshake successful. Octopus version: " + root.Version + "; API version: " + root.ApiVersion);

            var user = repository.Users.GetCurrent();

            if (user != null)
            {
                log.DebugFormat("Authenticated as: {0} <{1}> {2}", user.DisplayName, user.EmailAddress, user.IsService ? "(a service account)" : "");
            }

            Execute();
        }
コード例 #38
0
ファイル: GetVariable.cs プロジェクト: 40a/Octopus-Cmdlets
        private void LoadProjectVariableSet(IOctopusRepository octopus)
        {
            // Find the project that owns the variables we want to get
            var project = octopus.Projects.FindByName(Project);

            if (project == null)
            {
                throw new Exception(string.Format("Project '{0}' was not found.", Project));
            }

            // Get the variable set
            _variableSets.Add(octopus.VariableSets.Get(project.Link("Variables")));
        }
コード例 #39
0
 public static IOctopusSystemRepository ForSystem(this IOctopusRepository repo)
 {
     return(repo.Client.ForSystem());
 }
コード例 #40
0
 public static IEnumerable <Variable> ToModel(this VariableSetResource resource, DeploymentProcessResource deploymentProcessResource, IOctopusRepository repository)
 {
     return(resource.Variables.Select(v => v.ToModel(deploymentProcessResource, repository)));
 }
コード例 #41
0
 public static ScopeSpecification UpdateWith(this ScopeSpecification resource, IReadOnlyDictionary <VariableScopeType, IEnumerable <ElementReference> > model, IOctopusRepository repository, DeploymentProcessResource deploymentProcess, ProjectResource project)
 {
     resource.Clear();
     foreach (var kv in model)
     {
         resource.Add((ScopeField)kv.Key, new ScopeValue(kv.Value.Select(reference => ResolveId(kv.Key, reference, repository, deploymentProcess, project))));
     }
     return(resource);
 }
コード例 #42
0
 public static VariableSetResource UpdateWith(this VariableSetResource resource, IVariableSet model, IOctopusRepository repository, DeploymentProcessResource deploymentProcess, ProjectResource project)
 {
     resource.Variables = model.Variables.Select(v => new VariableResource().UpdateWith(v, repository, deploymentProcess, project)).ToList();
     return(resource);
 }
コード例 #43
0
ファイル: RemoveVariable.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            // Find the project that owns the variables we want to edit
            var project = _octopus.Projects.FindByName(Project);

            if (project == null)
                throw new Exception(string.Format("Project '{0}' was not found.", Project));

            // Get the variables for editing
            _variableSet = _octopus.VariableSets.Get(project.Link("Variables"));
        }
コード例 #44
0
ファイル: GetMachineRole.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            _roles = _octopus.MachineRoles.GetAllRoleNames();
        }
コード例 #45
0
ファイル: GetVariable.cs プロジェクト: 40a/Octopus-Cmdlets
        private void LoadLibraryVariableSetByIds(IOctopusRepository octopus)
        {
            // Find the library variable sets that owns the variables we want to get
            foreach (var id in VariableSetId)
            {
                var idForClosure = id;
                var variableSet = octopus.LibraryVariableSets.FindOne(vs =>
                    vs.Id == idForClosure);

                if (variableSet == null)
                    WriteWarning(string.Format("Library variable set with id '{0}' was not found.", id));
                else
                    _variableSets.Add(octopus.VariableSets.Get(variableSet.Link("Variables")));
            }
        }
コード例 #46
0
ファイル: GetVariable.cs プロジェクト: 40a/Octopus-Cmdlets
        private void LoadLibraryVariableSetByNames(IOctopusRepository octopus)
        {
            // Find the library variable sets that owns the variables we want to get
            foreach (var name in VariableSet)
            {
                var nameForClosure = name;
                var variableSet = octopus.LibraryVariableSets.FindOne(vs =>
                    vs.Name.Equals(nameForClosure, StringComparison.InvariantCultureIgnoreCase));

                if (variableSet == null)
                    WriteWarning(string.Format("Library variable set '{0}' was not found.", name));
                else
                    _variableSets.Add(octopus.VariableSets.Get(variableSet.Link("Variables")));
            }
        }
コード例 #47
0
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            var libraryVariableSet =
                _octopus.LibraryVariableSets.FindOne(
                    v => v.Name.Equals(VariableSet, StringComparison.InvariantCultureIgnoreCase));

            if (libraryVariableSet == null)
                throw new Exception(string.Format("Library variable set '{0}' was not found.", VariableSet));

            _variableSet = _octopus.VariableSets.Get(libraryVariableSet.Link("Variables"));
            WriteDebug("Found variable set" + _variableSet.Id);
        }
コード例 #48
0
 public ProjectExporter(IOctopusRepository repository, IOctopusFileSystem fileSystem, ILog log)
     : base(repository, fileSystem, log)
 {
     actionTemplateRepository = new ActionTemplateRepository(repository.Client);
 }
コード例 #49
0
ファイル: GetAction.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            // Find the project that owns the variables we want to get
            var project = _octopus.Projects.FindByName(Project);

            if (project == null)
            {
                const string msg = "Project '{0}' was not found.";
                throw new Exception(string.Format(msg, Project));
            }

            var id = project.DeploymentProcessId;
            _deploymentProcess = _octopus.DeploymentProcesses.Get(id);
        }
コード例 #50
0
ファイル: AddMachine.cs プロジェクト: 40a/Octopus-Cmdlets
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            if (ParameterSetName != "ByName") return;

            if (Environment.Length != 1)
                throw new Exception(string.Format("Only 1 Environment is currently supported, you specified {0}", Environment.Length));

            var environmentIds = new List<string>();
            foreach (var environment in Environment)
            {
                var e = _octopus.Environments.FindByName(environment);
                if (e == null)
                    throw new Exception(string.Format("Environment '{0}' was not found.", environment));
                environmentIds.Add(e.Id);
            }
            EnvironmentId = environmentIds.ToArray();
        }
コード例 #51
0
 public ReleaseImporter(IOctopusRepository repository, IOctopusFileSystem fileSystem, ILog log)
     : base(repository, fileSystem, log)
 {
 }
コード例 #52
0
 public LicensesRepository(IOctopusRepository repository)
     : base(repository, "CurrentLicense")
 {
 }
コード例 #53
0
 public ProjectTriggerRepository(IOctopusRepository repository)
     : base(repository, "ProjectTriggers")
 {
 }
コード例 #54
0
ファイル: GetRelease.cs プロジェクト: 40a/Octopus-Cmdlets
        //private List<ReleaseResource> _releases;
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            switch (ParameterSetName)
            {
                case "ByProject":
                    _project = _octopus.Projects.FindByName(Project);
                    if (_project == null)
                        throw new Exception(string.Format("The project '{0}' was not found.", Project));
                    break;
                case "ByProjectId":
                    _project = _octopus.Projects.Get(ProjectId);
                    if (_project == null)
                        throw new Exception(string.Format("A project with the id '{0}' was not found.", ProjectId));
                    break;
            }

            //if (!Cache || Extensions.Cache.Releases.IsExpired)
            //    _releases = _octopus.Projects.GetReleases(_project).Items.ToList();

            //if (Cache)
            //{
            //    if (Extensions.Cache.Releases.IsExpired)
            //        Extensions.Cache.Releases.Set(_releases);
            //    else
            //        _releases = Extensions.Cache.Releases.Values;
            //}

            WriteDebug("Loaded releases");
        }
コード例 #55
0
 public UserRepository(IOctopusRepository repository)
     : base(repository, "Users")
 {
     invitations = new LegacyInvitationRepository(repository);
 }
コード例 #56
0
 public UserPermissionsRepository(IOctopusRepository repository)
     : base(repository, null)
 {
 }
コード例 #57
0
ファイル: CopyProject.cs プロジェクト: 40a/Octopus-Cmdlets
 /// <summary>
 /// BeginProcessing
 /// </summary>
 protected override void BeginProcessing()
 {
     _octopus = Session.RetrieveSession(this);
 }
コード例 #58
0
 UserPermissionsRepository(IOctopusRepository repository, SpaceContext userDefinedSpaceContext)
     : base(repository, null, userDefinedSpaceContext)
 {
 }
コード例 #59
0
 public Job(IPortalApplication portalApplication, IOctopusRepository repository) : base(portalApplication)
 {
   Repository = repository;
 }
コード例 #60
0
        /// <summary>
        /// BeginProcessing
        /// </summary>
        protected override void BeginProcessing()
        {
            _octopus = Session.RetrieveSession(this);

            WriteDebug("Connection established");
        }