CoreService

<back to all web services

GetHostNames

HostName - CRUD

Returns a list of hostnames

Requires Authentication
Required role:TenantReaderRequires the role:Workflow
The following routes are available for this service:
GET/api/resourceaddons/hostnamesReturns a list of hostnames for one time use (the pool will never return already obtained hostnames)
GET/resourceaddons/hostnamesReturns a list of hostnames for one time use (the pool will never return already obtained hostnames)
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.HostNames.Crud;
using YCO.Dune.Models.Dtos.Common.Responses;
using CoreService.ServiceModel.Dtos.Base.Responses;
using CoreService.ServiceModel.Enums;

namespace CoreService.ServiceModel.Dtos.Base.Responses
{
    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.HostNames.Crud
{
    ///<summary>
    ///Returns a list of hostnames
    ///</summary>
    [Api(Description="Returns a list of hostnames")]
    [ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(YCO.Dune.Models.Dtos.Common.Responses.ItemsResponse`1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]), StatusCode=200)]
    public partial class GetHostNames
        : IBaseRequest, IHasTenantName, IGet
    {
        [ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
        [Validate("NotEmpty")]
        public virtual string TenantName { get; set; }

        ///<summary>
        ///If set, hostnames will be created using it
        ///</summary>
        [ApiMember(DataType="string", Description="If set, hostnames will be created using it", ParameterType="query")]
        [Validate("MaximumLength(2)")]
        public virtual string? Prefix { get; set; }

        ///<summary>
        ///Defines how long the hostname will be including the prefix
        ///</summary>
        [ApiMember(DataType="int", Description="Defines how long the hostname will be including the prefix", ParameterType="query")]
        [Validate("ExclusiveBetween(7,17)")]
        public virtual int? Length { get; set; }

        ///<summary>
        ///The number of hostnames to be returned
        ///</summary>
        [ApiMember(DataType="int", Description="The number of hostnames to be returned", IsRequired=true)]
        [Validate("GreaterThanOrEqual(1)")]
        public virtual int Count { 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.Dtos.Common.Responses
{
    public partial class ItemsResponse<T>
    {
        public virtual IList<VariableDto> Items { get; set; }
        public virtual int Offset { get; set; }
        public virtual int Total { get; set; }
        public virtual bool IsGrouped { get; set; }
        public virtual ResponseStatus? ResponseStatus { get; set; }
        public virtual Dictionary<string, string>? Meta { get; set; }
    }

}

C# GetHostNames 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/resourceaddons/hostnames HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"items":null,"offset":0,"total":0,"isGrouped":false,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"meta":{"String":"String"}}