public List <TResource> GetAll()
        {
            var link       = ResolveLink();
            var parameters = ParameterHelper.CombineParameters(AdditionalQueryParameters, new { id = IdValueConstant.IdAll });

            return(client.Get <List <TResource> >(link, parameters));
        }
        public T Get <T>() where T : class, IResource, new()
        {
            var instance          = new T();
            var configurationItem = GetConfigurationItem(instance);

            return(client.Get <T>(configurationItem.Link("Values")));
        }
        public DeploymentSettingsResource Get(ProjectResource projectResource, string gitRef)
        {
            if (!projectResource.IsVersionControlled)
            {
                throw new NotSupportedException(
                          $"Database backed projects require using the overload that does not include a gitRef parameter.");
            }

            return(client.Get <DeploymentSettingsResource>(projectResource.Link("DeploymentSettings"), new { gitRef }));
        }
        public DeploymentProcessResource Get(ProjectResource projectResource, string gitref = null)
        {
            if (!string.IsNullOrWhiteSpace(gitref))
            {
                var branchResource = repository.Projects.Beta().GetVersionControlledBranch(projectResource, gitref);

                return(client.Get <DeploymentProcessResource>(branchResource.Link("DeploymentProcess")));
            }

            return(client.Get <DeploymentProcessResource>(projectResource.Link("DeploymentProcess")));
        }
Exemple #5
0
 public ActionTemplateResource Get(string idOrHref)
 {
     if (string.IsNullOrWhiteSpace(idOrHref))
     {
         return(null);
     }
     return(client.Get <ActionTemplateResource>(templatesPath, new { id = idOrHref }));
 }
        private PackageFromBuiltInFeedResource AttemptDeltaPush(string fileName, Stream contents, bool replaceExisting)
        {
            if (!client.RootDocument.HasLink("PackageDeltaSignature"))
            {
                Logger.Info("Server does not support delta compression for package push");
                return(null);
            }

            if (!PackageIdentityParser.TryParsePackageIdAndVersion(Path.GetFileNameWithoutExtension(fileName), out var packageId, out var version))
            {
                Logger.Info("Could not determine the package ID and/or version based on the supplied filename");
                return(null);
            }

            PackageSignatureResource signatureResult;

            try
            {
                Logger.Info($"Requesting signature for delta compression from the server for upload of a package with id '{packageId}' and version '{version}'");
                signatureResult = client.Get <PackageSignatureResource>(client.RootDocument.Link("PackageDeltaSignature"), new { packageId, version });
            }
            catch (OctopusResourceNotFoundException)
            {
                Logger.Info("No package with the same ID exists on the server");
                return(null);
            }

            using (var deltaTempFile = new TemporaryFile())
            {
                var shouldUpload = DeltaCompression.CreateDelta(contents, signatureResult, deltaTempFile.FileName);
                if (!shouldUpload)
                {
                    return(null);
                }

                using (var delta = File.OpenRead(deltaTempFile.FileName))
                {
                    var result = client.Post <FileUpload, PackageFromBuiltInFeedResource>(
                        client.RootDocument.Link("PackageDeltaUpload"),
                        new FileUpload()
                    {
                        Contents = delta, FileName = Path.GetFileName(fileName)
                    },
                        new { replace = replaceExisting, packageId, signatureResult.BaseVersion });

                    Logger.Info($"Delta transfer completed");
                    return(result);
                }
            }
        }
        /// <summary>
        /// Gathers the Users from a Team.
        /// </summary>
        /// <param name="client">The Repository this is tacked on to.</param>
        /// <param name="team">The team to return the user resources from.</param>
        /// <returns>Enumerable of UserResources.</returns>
        internal static IEnumerable <UserResource> GetTeamUsers(this IOctopusClient client, TeamResource team)
        {
            List <UserResource> users = new List <UserResource>();

            foreach (var userId in team.MemberUserIds)
            {
                var user = client.Get <UserResource>(string.Format(ResourceStrings.TeamUserIdFormat, userId));
                if (user != null)
                {
                    users.Add(user);
                }
            }
            return(users);
        }
 public BackupConfigurationResource GetConfiguration()
 {
     return(client.Get <BackupConfigurationResource>(client.RootDocument.Link("BackupConfiguration")));
 }
 public ScheduledTaskDetailsResource GetLogs(string taskName)
 {
     return(client.Get <ScheduledTaskDetailsResource>($"~/api/scheduler/{taskName}/logs"));
 }
 public VersionControlBranchResource[] GetVersionControlledBranches(ProjectResource projectResource)
 {
     return(client.Get <VersionControlBranchResource[]>(projectResource.Link("Branches")));
 }
 public PerformanceConfigurationResource Get()
 {
     return(client.Get <PerformanceConfigurationResource>(client.RootDocument.Link("PerformanceConfiguration")));
 }
Exemple #12
0
 public ResourceCollection <VersionControlBranchResource> GetVersionControlledBranches(ProjectResource projectResource)
 {
     return(client.Get <ResourceCollection <VersionControlBranchResource> >(projectResource.Link("Branches")));
 }
Exemple #13
0
 public DashboardConfigurationResource GetDashboardConfiguration()
 {
     return(client.Get <DashboardConfigurationResource>(client.RootDocument.Link("DashboardConfiguration")));
 }
 /// <summary>
 /// Gets the MaintenanceConfiguration Resource to the server.
 /// </summary>
 /// <param name="client">The Repository this is tacked on to.</param>
 /// <returns>The Servers' MaintenanceConfiguration.</returns>
 internal static MaintenanceConfigurationResource GetMaintenanceConfigurationResource(this IOctopusClient client)
 {
     return(client.Get <MaintenanceConfigurationResource>(ResourceStrings.MaintenanceConfigApi));
 }
 public DashboardResource GetDashboard()
 {
     return(client.Get <DashboardResource>(client.RootDocument.Link("Dashboard")));
 }
 public List <TResource> GetAll()
 {
     return(client.Get <List <TResource> >(client.RootDocument.Link(CollectionLinkName), new { id = "all" }));
 }
 /// <summary>
 /// Gets the Usage resource of the passed ActionTemplate.
 /// </summary>
 /// <param name="client">The Repository this is tacked on to.</param>
 /// <param name="actionTemplate">The action template to get more info about.</param>
 /// <returns>The List of action template usages.</returns>
 internal static IEnumerable <ActionTemplateUsageResource> GetActionTemplateUsage(this IOctopusClient client, ActionTemplateResource actionTemplate)
 {
     return(client.Get <IEnumerable <ActionTemplateUsageResource> >(actionTemplate.Link(ResourceStrings.UsageLink)));
 }
 public List <string> GetAllRoleNames()
 {
     return(client.Get <string[]>(client.RootDocument.Link("MachineRoles")).ToList());
 }
 public FeaturesConfigurationResource GetFeaturesConfiguration()
 {
     return(client.Get <FeaturesConfigurationResource>(client.RootDocument.Link("FeaturesConfiguration")));
 }