public OctopusAsyncRepository(IOctopusAsyncClient client)
 {
     this.Client = client;
     Feeds = new FeedRepository(client);
     Backups = new BackupRepository(client);
     ActionTemplates = new ActionTemplateRepository(client);
     CommunityActionTemplates = new CommunityActionTemplateRepository(client);
     Machines = new MachineRepository(client);
     MachineRoles = new MachineRoleRepository(client);
     MachinePolicies = new MachinePolicyRepository(client);
     Environments = new EnvironmentRepository(client);
     Events = new EventRepository(client);
     FeaturesConfiguration = new FeaturesConfigurationRepository(client);
     ProjectGroups = new ProjectGroupRepository(client);
     Projects = new ProjectRepository(client);
     Proxies = new ProxyRepository(client);
     Tasks = new TaskRepository(client);
     Users = new UserRepository(client);
     VariableSets = new VariableSetRepository(client);
     LibraryVariableSets = new LibraryVariableSetRepository(client);
     DeploymentProcesses = new DeploymentProcessRepository(client);
     Releases = new ReleaseRepository(client);
     Deployments = new DeploymentRepository(client);
     Certificates = new CertificateRepository(client);
     Dashboards = new DashboardRepository(client);
     DashboardConfigurations = new DashboardConfigurationRepository(client);
     Artifacts = new ArtifactRepository(client);
     Interruptions = new InterruptionRepository(client);
     ServerStatus = new ServerStatusRepository(client);
     UserRoles = new UserRolesRepository(client);
     Teams = new TeamsRepository(client);
     RetentionPolicies = new RetentionPolicyRepository(client);
     Accounts = new AccountRepository(client);
     Defects = new DefectsRepository(client);
     Lifecycles = new LifecyclesRepository(client);
     OctopusServerNodes = new OctopusServerNodeRepository(client);
     Channels = new ChannelRepository(client);
     ProjectTriggers = new ProjectTriggerRepository(client);
     Schedulers = new SchedulerRepository(client);
     Subscriptions = new SubscriptionRepository(client);
     Tenants = new TenantRepository(client);
     TagSets = new TagSetRepository(client);
     BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client);
 }
        public void SetUp()
        {
            clientFactory = Substitute.For<IOctopusClientFactory>();
            client = Substitute.For<IOctopusAsyncClient>();
            clientFactory.CreateAsyncClient(Arg.Any<OctopusServerEndpoint>()).Returns(client);
            operation = new RegisterMachineOperation(clientFactory);
            serverEndpoint = new OctopusServerEndpoint("http://octopus", "ABC123");

            environments = new ResourceCollection<EnvironmentResource>(new EnvironmentResource[0], LinkCollection.Self("/foo"));
            machines = new ResourceCollection<MachineResource>(new MachineResource[0], LinkCollection.Self("/foo"));
            client.RootDocument.Returns(new RootResource {Links = LinkCollection.Self("/api").Add("Environments", "/api/environments").Add("Machines", "/api/machines")});

            client.When(x => x.Paginate(Arg.Any<string>(), Arg.Any<object>(), Arg.Any<Func<ResourceCollection<EnvironmentResource>, bool>>()))
                .Do(ci => ci.Arg<Func<ResourceCollection<EnvironmentResource>, bool>>()(environments));

            client.When(x => x.Paginate(Arg.Any<string>(), Arg.Any<object>(), Arg.Any<Func<ResourceCollection<MachineResource>, bool>>()))
                .Do(ci => ci.Arg<Func<ResourceCollection<MachineResource>, bool>>()(machines));

            client.List<MachineResource>(Arg.Any<string>(), Arg.Any<object>()).Returns(machines);
        }
 public MachineRoleRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
Пример #4
0
 public SchedulerRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
Пример #5
0
        public async Task Execute(string[] commandLineArguments)
        {
            var remainingArguments = Options.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);

#if !HTTP_CLIENT_SUPPORTS_SSL_OPTIONS
            ServicePointManager.ServerCertificateValidationCallback = ServerCertificateValidationCallback;
#endif

            client = await clientFactory.CreateAsyncClient(endpoint, new OctopusClientOptions()
            {
#if HTTP_CLIENT_SUPPORTS_SSL_OPTIONS
                IgnoreSslErrors = ignoreSslErrors
#endif
            }).ConfigureAwait(false);
            Repository = repositoryFactory.CreateRepository(client);
            RepositoryCommonQueries = new OctopusRepositoryCommonQueries(Repository, Log);

            if (enableDebugging)
            {
                Repository.Client.SendingOctopusRequest += request => Log.Debug("{Method:l} {Uri:l}", request.Method, request.Uri);
            }

            Log.Debug("Handshaking with Octopus server: {Url:l}", ServerBaseUrl);
            var root = Repository.Client.RootDocument;
            Log.Debug("Handshake successful. Octopus version: {Version:l}; API version: {ApiVersion:l}", root.Version, root.ApiVersion);

            var user = await Repository.Users.GetCurrent().ConfigureAwait(false);
            if (user != null)
            {
                Log.Debug("Authenticated as: {Name:l} <{EmailAddress:l}> {IsService:l}", user.DisplayName, user.EmailAddress, user.IsService ? "(a service account)" : "");
            }

            ValidateParameters();
            await Execute().ConfigureAwait(false);
        }
 public DashboardConfigurationRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
Пример #7
0
 public DeploymentSettingsRepository(IOctopusAsyncRepository repository)
 {
     client = repository.Client;
 }
Пример #8
0
 public BackupRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
Пример #9
0
 public EventRepository(IOctopusAsyncClient client)
     : base(client, "Events")
 {
 }
 public IOctopusAsyncRepository CreateRepository(IOctopusAsyncClient client)
 {
     return client.CreateRepository();
 }
Пример #11
0
 public TaskRepository(IOctopusAsyncClient client)
     : base(client, "Tasks")
 {
 }
Пример #12
0
 public TenantRepository(IOctopusAsyncClient client)
     : base(client, "Tenants")
 {
 }
Пример #13
0
 public UserRepository(IOctopusAsyncClient client)
     : base(client, "Users")
 {
     invitations = new InvitationRepository(client);
 }
 public ActionTemplateRepository(IOctopusAsyncClient client)
 {
     this.client = client;
     
 }
        private static async Task RemoveEnvFromLifecycles(IReadOnlyCollection <LifecycleResource> lifeCycles,
                                                          IEnumerable <EnvironmentResource> environments, IOctopusAsyncClient client, bool dryRun)
        {
            foreach (var env in environments)
            {
                foreach (var lifecycle in lifeCycles)
                {
                    foreach (var phase in lifecycle.Phases)
                    {
                        if (phase.OptionalDeploymentTargets.Contains(env.Id))
                        {
                            phase.OptionalDeploymentTargets.Remove(env.Id);
                        }
                    }
                }
            }

            if (dryRun)
            {
                return;
            }

            foreach (var lifecycle in lifeCycles)
            {
                await client.Repository.Lifecycles.Modify(lifecycle);
            }
        }
 public FeaturesConfigurationRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
 public ActionTemplateRepository(IOctopusAsyncClient client) : base(client, "ActionTemplates")
 {
 }
 public BuiltInPackageRepositoryRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
Пример #19
0
 public BackupRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
Пример #20
0
 public DashboardRepository(IOctopusAsyncClient client)
 {
     this.client = client;
 }
 public CertificateConfigurationRepository(IOctopusAsyncClient client) : base(client, DetermineCollectionLinkName(client))
 {
 }