CoreService

<back to all web services

GetCollection

Collection - CRUD

Returns a single collection by its id

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/api/collections/{Id}Returns a collection
GET/collections/{Id}Returns a collection
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using CoreService.ServiceModel.Dtos.Collections.Crud;
using CoreService.ServiceModel.Dtos.Collections.Responses;
using CoreService.ServiceModel.Dtos.Base.Responses;
using YCO.Dune.Models.Enums;
using CoreService.ServiceModel.Dtos.Tenant.Responses;
using CoreService.ServiceModel.Enums;

namespace CoreService.ServiceModel.Dtos.Base.Responses
{
    public partial class ConfigItemDto
        : IConfigItem
    {
        public virtual Guid Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string DisplayName { get; set; }
        public virtual string? Description { get; set; }
        public virtual ObjectTypes ObjectType { get; set; }
        public virtual string SelfLink { get; set; }
        public virtual IList<TagDto> Tags { get; set; }
        public virtual IList<PathItemDto> Path { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual string CreateUser { get; set; }
        public virtual string CreateUserId { get; set; }
        public virtual DateTime Modified { get; set; }
        public virtual string ModifyUser { get; set; }
        public virtual string ModifyUserId { get; set; }
        public virtual bool IsDeleted { get; set; }
        public virtual DateTime? Deleted { get; set; }
        public virtual string? DeleteUser { get; set; }
        public virtual string? DeleteUserId { get; set; }
        public virtual IList<LinkDto> Links { get; set; }
    }

    public partial class LinkDto
    {
        public virtual string Caption { get; set; }
        public virtual string Rel { get; set; }
        public virtual string HRef { get; set; }
        public virtual string Method { get; set; }
    }

    public partial class PathItemDto
    {
        public virtual string Label { get; set; }
        public virtual string Link { get; set; }
        public virtual ObjectTypes ObjectType { get; set; }
        public virtual Guid ObjectId { get; set; }
    }

    public partial class TagDto
    {
        public virtual string Name { get; set; }
        public virtual string? Value { get; set; }
        public virtual bool IsProtected { get; set; }
    }

    public partial class VariableDto
    {
        public virtual string Name { get; set; }
        ///<summary>
        ///Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false, List = [1,2,3,4]). Note: string values need extra quotes
        ///</summary>
        public virtual string Value { get; set; }
        ///<summary>
        ///The data type of the value property
        ///</summary>
        public virtual ValueDataType Type { get; set; }
        public virtual string? Description { get; set; }
        public virtual bool IsInherited { get; set; }
        public virtual Environments? Environment { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.Collections.Crud
{
    ///<summary>
    ///Returns a single collection by its id
    ///</summary>
    [Api(Description="Returns a single collection by its id")]
    [ApiResponse(Description="The request ended successful", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.Collections.Responses.DeploymentCollectionDto), StatusCode=200)]
    public partial class GetCollection
        : IGetSingleRequest, IHasId, IHasTenantName, IGet
    {
        ///<summary>
        ///The unique id of the collection
        ///</summary>
        [ApiMember(DataType="string", Description="The unique id of the collection", Format="guid", IsRequired=true, ParameterType="path")]
        public virtual Guid Id { get; set; }

        [ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
        [Validate("NotEmpty")]
        public virtual string TenantName { get; set; }

        ///<summary>
        ///If true, also soft deleted items will be returned
        ///</summary>
        [ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")]
        public virtual bool? IncludeDeleted { get; set; }

        ///<summary>
        ///Returns all referenced object
        ///</summary>
        [ApiMember(Description="Returns all referenced object", ParameterType="query")]
        public virtual bool? IncludeReferencedObjects { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.Collections.Responses
{
    public partial class DeploymentCollectionDto
        : ConfigItemDto, IHasTenantId
    {
        public virtual Guid TenantId { get; set; }
        public virtual TenantDto? Tenant { get; set; }
        ///<summary>
        ///A collection scoped list of variables
        ///</summary>
        public virtual IList<VariableDto> Variables { get; set; }
        ///<summary>
        ///Defines the collection where scanned but not deployed resources will be stored
        ///</summary>
        public virtual bool IsLostAndFound { get; set; }
        ///<summary>
        ///The monthly cost budget for the whole collection
        ///</summary>
        public virtual decimal? MonthlyBudget { get; set; }
        ///<summary>
        ///Whether to send budget information mails to the collection owners
        ///</summary>
        public virtual bool? SendBudgetNotificationMails { get; set; }
        ///<summary>
        ///A threshold, when to send the first budget warning mail
        ///</summary>
        public virtual int? BudgetWarningThresholdPercent { get; set; }
        public virtual IList<LinkDto> Links { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.Tenant.Responses
{
    public partial class TenantDto
        : ConfigItemDto
    {
        ///<summary>
        ///Variables defined on tenant level
        ///</summary>
        public virtual IList<VariableDto> Variables { get; set; }
        ///<summary>
        ///Allowed email domains used for authentication
        ///</summary>
        public virtual IList<string> AllowedMailDomains { get; set; }
        ///<summary>
        ///List of licensed modules for this tenant
        ///</summary>
        public virtual IList<string> LicensedModules { get; set; }
        ///<summary>
        ///Amount of days until a Deployment expires
        ///</summary>
        public virtual short DefaultDeploymentLifetimeDays { get; set; }
        ///<summary>
        ///Max amount of days until a Deployment expires
        ///</summary>
        public virtual short MaxDeploymentLifetimeDays { get; set; }
        ///<summary>
        ///Amount of days without patching until a unpatched warning is shown
        ///</summary>
        public virtual short SystemUnpatchedWarningDays { get; set; }
        ///<summary>
        ///Amount of hours without backup until a backup missing warning is shown
        ///</summary>
        public virtual short SystemBackupMissingWarningHours { get; set; }
        ///<summary>
        ///Amount of days until a vulnerable resource is getting stopped
        ///</summary>
        public virtual short StopVulnerableResourceAfterDays { get; set; }
        ///<summary>
        ///Amount of days before deployment expiration, which triggers the expiration warning
        ///</summary>
        public virtual short DeploymentExpirationWarningDays { get; set; }
        ///<summary>
        ///Amount of days the patch notification is sent out prior to the patch date
        ///</summary>
        public virtual short PatchNotificationDays { get; set; }
        ///<summary>
        ///Use a pool with your own hostnames (true) or let the hostname be auto generated (false)
        ///</summary>
        public virtual bool UseCustomHostnames { get; set; }
        ///<summary>
        ///After how many days inactive vulnerabilities will be purged from database
        ///</summary>
        public virtual short RemoveInactiveVulnerabilitiesAfterDays { get; set; }
        public virtual IList<LinkDto> Links { get; set; }
    }

}

namespace CoreService.ServiceModel.Enums
{
    public enum Environments
    {
        Lab,
        Poc,
        Dev,
        Test,
        Int,
        Uat,
        Prod,
    }

    public enum ValueDataType
    {
        String,
        Number,
        Boolean,
        List,
    }

}

namespace YCO.Dune.Models.Enums
{
    public enum ObjectTypes
    {
        None,
        ConfigItem,
        Tenant,
        Collection,
        Resource,
        ComputeNode,
        VirtualMachine,
        PhysicalMachine,
        Disk,
        Subnet,
        IPAddress,
        Job,
        JobEvent,
        FreezePeriod,
        ResourceGroup,
        Deployment,
        ResourceGroupTemplate,
        DeploymentTemplate,
        ResourceProvider,
        GenericResource,
        Role,
        Permission,
        User,
        PatchingWindow,
        Update,
        ReportDefinition,
        TimeSeries,
        DataPoint,
        Action,
        ActionAssignment,
        UserNote,
    }

}

C# GetCollection DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /api/collections/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"tenantId":"00000000-0000-0000-0000-000000000000","tenant":{"variables":null,"allowedMailDomains":null,"licensedModules":null,"defaultDeploymentLifetimeDays":0,"maxDeploymentLifetimeDays":0,"systemUnpatchedWarningDays":0,"systemBackupMissingWarningHours":0,"stopVulnerableResourceAfterDays":0,"deploymentExpirationWarningDays":0,"patchNotificationDays":0,"useCustomHostnames":false,"removeInactiveVulnerabilitiesAfterDays":0,"links":[{"caption":"Collections","rel":"down","hRef":"/collections/","method":"GET"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String"},"variables":null,"isLostAndFound":false,"monthlyBudget":0,"sendBudgetNotificationMails":false,"budgetWarningThresholdPercent":0,"links":[{"caption":"Index","rel":"up","hRef":"/collections/","method":"GET"},{"caption":"Deployments","rel":"down","hRef":"/deployments?parentId=00000000-0000-0000-0000-000000000000","method":"GET"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String"}