| Required role: | TenantReader | Requires the role: | Workflow |
| GET | /api/resourceaddons/hostnames | Returns a list of hostnames for one time use (the pool will never return already obtained hostnames) | |
|---|---|---|---|
| GET | /resourceaddons/hostnames | Returns a list of hostnames for one time use (the pool will never return already obtained hostnames) |
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
/** @description Returns a list of hostnames */
// @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)
class GetHostNames implements IBaseRequest, IHasTenantName, IGet, JsonSerializable
{
public function __construct(
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
/** @var string */
public string $tenantName='',
/** @description If set, hostnames will be created using it */
// @ApiMember(DataType="string", Description="If set, hostnames will be created using it", ParameterType="query")
// @Validate(Validator="MaximumLength(2)")
/** @var string|null */
public ?string $prefix=null,
/** @description Defines how long the hostname will be including the prefix */
// @ApiMember(DataType="int", Description="Defines how long the hostname will be including the prefix", ParameterType="query")
// @Validate(Validator="ExclusiveBetween(7,17)")
/** @var int|null */
public ?int $length=null,
/** @description The number of hostnames to be returned */
// @ApiMember(DataType="int", Description="The number of hostnames to be returned", IsRequired=true)
// @Validate(Validator="GreaterThanOrEqual(1)")
/** @var int */
public int $count=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
if (isset($o['prefix'])) $this->prefix = $o['prefix'];
if (isset($o['length'])) $this->length = $o['length'];
if (isset($o['count'])) $this->count = $o['count'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
if (isset($this->prefix)) $o['prefix'] = $this->prefix;
if (isset($this->length)) $o['length'] = $this->length;
if (isset($this->count)) $o['count'] = $this->count;
return empty($o) ? new class(){} : $o;
}
}
enum ValueDataType : string
{
case String = 'String';
case Number = 'Number';
case Boolean = 'Boolean';
case List = 'List';
}
enum Environments : string
{
case Lab = 'Lab';
case Poc = 'Poc';
case Dev = 'Dev';
case Test = 'Test';
case Int = 'Int';
case Uat = 'Uat';
case Prod = 'Prod';
}
class VariableDto implements JsonSerializable
{
public function __construct(
/** @var string */
public string $name='',
/** @description 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 */
/** @var string */
public string $value='',
/** @description The data type of the value property */
/** @var ValueDataType|null */
public ?ValueDataType $type=null,
/** @var string|null */
public ?string $description=null,
/** @var bool|null */
public ?bool $isInherited=null,
/** @var Environments|null */
public ?Environments $environment=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['value'])) $this->value = $o['value'];
if (isset($o['type'])) $this->type = JsonConverters::from('ValueDataType', $o['type']);
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['isInherited'])) $this->isInherited = $o['isInherited'];
if (isset($o['environment'])) $this->environment = JsonConverters::from('Environments', $o['environment']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->value)) $o['value'] = $this->value;
if (isset($this->type)) $o['type'] = JsonConverters::to('ValueDataType', $this->type);
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->isInherited)) $o['isInherited'] = $this->isInherited;
if (isset($this->environment)) $o['environment'] = JsonConverters::to('Environments', $this->environment);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class ItemsResponse implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): ItemsResponse {
$to = new ItemsResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var array<VariableDto>|null */
public mixed $items=null,
/** @var int */
public mixed $offset=0,
/** @var int */
public mixed $total=0,
/** @var bool|null */
public mixed $isGrouped=null,
/** @var ResponseStatus|null */
public mixed $responseStatus=null,
/** @var array<string,string>|null */
public mixed $meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['items'])) $this->items = JsonConverters::fromArray('VariableDto', $o['items']);
if (isset($o['offset'])) $this->offset = $o['offset'];
if (isset($o['total'])) $this->total = $o['total'];
if (isset($o['isGrouped'])) $this->isGrouped = $o['isGrouped'];
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->items)) $o['items'] = JsonConverters::toArray('VariableDto', $this->items);
if (isset($this->offset)) $o['offset'] = $this->offset;
if (isset($this->total)) $o['total'] = $this->total;
if (isset($this->isGrouped)) $o['isGrouped'] = $this->isGrouped;
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
return empty($o) ? new class(){} : $o;
}
}
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
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"}}