CoreService

<back to all web services

ValidateDeploymentName

Deployment - CRUD

Validate deployment name with the user defined part

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
PATCH/api/deployments/validation/nameValidate deployment name with the user defined part
PATCH/deployments/validation/nameValidate deployment name with the user defined part
<?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};


enum Severity : string
{
    case Error = 'Error';
    case Warning = 'Warning';
    case Info = 'Info';
}

class ValidationFailure implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $propertyName=null,
        /** @var string|null */
        public ?string $errorMessage=null,
        /** @var Object|null */
        public ?Object $attemptedValue=null,
        /** @var Object|null */
        public ?Object $customState=null,
        /** @var Severity|null */
        public ?Severity $severity=null,
        /** @var Object[]|null */
        public ?array $formattedMessageArguments=null,
        /** @var array<string,Object>|null */
        public ?array $formattedMessagePlaceholderValues=null,
        /** @var string|null */
        public ?string $errorCode=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['propertyName'])) $this->propertyName = $o['propertyName'];
        if (isset($o['errorMessage'])) $this->errorMessage = $o['errorMessage'];
        if (isset($o['attemptedValue'])) $this->attemptedValue = JsonConverters::from('Object', $o['attemptedValue']);
        if (isset($o['customState'])) $this->customState = JsonConverters::from('Object', $o['customState']);
        if (isset($o['severity'])) $this->severity = JsonConverters::from('Severity', $o['severity']);
        if (isset($o['formattedMessageArguments'])) $this->formattedMessageArguments = JsonConverters::fromArray('Object', $o['formattedMessageArguments']);
        if (isset($o['formattedMessagePlaceholderValues'])) $this->formattedMessagePlaceholderValues = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $o['formattedMessagePlaceholderValues']);
        if (isset($o['errorCode'])) $this->errorCode = $o['errorCode'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->propertyName)) $o['propertyName'] = $this->propertyName;
        if (isset($this->errorMessage)) $o['errorMessage'] = $this->errorMessage;
        if (isset($this->attemptedValue)) $o['attemptedValue'] = JsonConverters::to('Object', $this->attemptedValue);
        if (isset($this->customState)) $o['customState'] = JsonConverters::to('Object', $this->customState);
        if (isset($this->severity)) $o['severity'] = JsonConverters::to('Severity', $this->severity);
        if (isset($this->formattedMessageArguments)) $o['formattedMessageArguments'] = JsonConverters::toArray('Object', $this->formattedMessageArguments);
        if (isset($this->formattedMessagePlaceholderValues)) $o['formattedMessagePlaceholderValues'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $this->formattedMessagePlaceholderValues);
        if (isset($this->errorCode)) $o['errorCode'] = $this->errorCode;
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @property Object|null $originalResponse
 * @property IRequest|null $request
 * @property int $statusCode
 * @property string|null $statusDescription
 * @property string|null $contentType
 * @property ByteArray|null $outputStream
 * @property Object|null $dto
 * @property bool $useBufferedStream
 * @property bool $isClosed
 * @property bool $keepAlive
 * @property bool $hasStarted
 * @property array<string,Object>|null $items
 */
interface IResponse
{
}

// @Flags()
enum RequestAttributes : int
{
    case None = 0;
    case Localhost = 1;
    case LocalSubnet = 2;
    case External = 4;
    case Secure = 8;
    case InSecure = 16;
    case AnySecurityMode = 24;
    case HttpHead = 32;
    case HttpGet = 64;
    case HttpPost = 128;
    case HttpPut = 256;
    case HttpDelete = 512;
    case HttpPatch = 1024;
    case HttpOptions = 2048;
    case HttpOther = 4096;
    case AnyHttpMethod = 8160;
    case OneWay = 8192;
    case Reply = 16384;
    case AnyCallStyle = 24576;
    case Soap11 = 32768;
    case Soap12 = 65536;
    case Xml = 131072;
    case Json = 262144;
    case Jsv = 524288;
    case ProtoBuf = 1048576;
    case Csv = 2097152;
    case Html = 4194304;
    case Jsonl = 8388608;
    case MsgPack = 16777216;
    case FormatOther = 33554432;
    case AnyFormat = 67076096;
    case Http = 67108864;
    case MessageQueue = 134217728;
    case Tcp = 268435456;
    case Grpc = 536870912;
    case EndpointOther = 1073741824;
    case AnyEndpoint = 2080374784;
    case InProcess = -2147483648;
    case InternalNetworkAccess = -2147483645;
    case AnyNetworkAccessType = -2147483641;
    case Any = -1;
}

/**
 * @property bool $acceptsBrotli
 * @property bool $acceptsDeflate
 * @property bool $acceptsGzip
 */
interface IRequestPreferences
{
}

/**
 * @property string|null $name
 * @property string|null $fileName
 * @property int $contentLength
 * @property string|null $contentType
 * @property ByteArray|null $inputStream
 */
interface IHttpFile
{
}

/**
 * @property Object|null $originalRequest
 * @property IResponse|null $response
 * @property string|null $operationName
 * @property string|null $verb
 * @property RequestAttributes $requestAttributes
 * @property IRequestPreferences|null $requestPreferences
 * @property Object|null $dto
 * @property string|null $contentType
 * @property bool $isLocal
 * @property string|null $userAgent
 * @property array<string,Cookie>|null $cookies
 * @property string|null $responseContentType
 * @property bool $hasExplicitResponseContentType
 * @property array<string,Object>|null $items
 * @property NameValueCollection|null $headers
 * @property NameValueCollection|null $queryString
 * @property NameValueCollection|null $formData
 * @property bool $useBufferedStream
 * @property string|null $rawUrl
 * @property string|null $absoluteUri
 * @property string|null $userHostAddress
 * @property string|null $remoteIp
 * @property string|null $authorization
 * @property bool $isSecureConnection
 * @property string[]|null $acceptTypes
 * @property string|null $pathInfo
 * @property string|null $originalPathInfo
 * @property ByteArray|null $inputStream
 * @property int $contentLength
 * @property IHttpFile[]|null $files
 * @property string|null $urlReferrer
 */
interface IRequest
{
}

class ValidationResult implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isValid=null,
        /** @var array<ValidationFailure>|null */
        public ?array $errors=null,
        /** @var string[]|null */
        public ?array $ruleSetsExecuted=null,
        /** @var IRequest|null */
        public ?IRequest $request=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['isValid'])) $this->isValid = $o['isValid'];
        if (isset($o['errors'])) $this->errors = JsonConverters::fromArray('ValidationFailure', $o['errors']);
        if (isset($o['ruleSetsExecuted'])) $this->ruleSetsExecuted = JsonConverters::fromArray('string', $o['ruleSetsExecuted']);
        if (isset($o['request'])) $this->request = JsonConverters::from('IRequest', $o['request']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->isValid)) $o['isValid'] = $this->isValid;
        if (isset($this->errors)) $o['errors'] = JsonConverters::toArray('ValidationFailure', $this->errors);
        if (isset($this->ruleSetsExecuted)) $o['ruleSetsExecuted'] = JsonConverters::toArray('string', $this->ruleSetsExecuted);
        if (isset($this->request)) $o['request'] = JsonConverters::to('IRequest', $this->request);
        return empty($o) ? new class(){} : $o;
    }
}

enum Environments : string
{
    case Lab = 'Lab';
    case Poc = 'Poc';
    case Dev = 'Dev';
    case Test = 'Test';
    case Int = 'Int';
    case Uat = 'Uat';
    case Prod = 'Prod';
}

/** @description Validate deployment name with the user defined part */
// @Api(Description="Validate deployment name with the user defined part")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(ServiceStack.FluentValidation.Results.ValidationResult)", StatusCode=200)
class ValidateDeploymentName implements IBaseRequest, IHasTenantName, IPatch, JsonSerializable
{
    public function __construct(
        // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $tenantName='',

        /** @description The full name in the form of '{userdefined}_{environment}' */
        // @ApiMember(DataType="string", Description="The full name in the form of '{userdefined}_{environment}'", IsRequired=true, ParameterType="body")
        // @Validate(Validator="NotEmpty")
        // @Validate(Validator="MaximumLength(100)")
        // @Validate(Validator="RegularExpression(′^([0-9a-z]+[0-9a-z-]*[0-9a-z]+)_([a-z]+)$′)")
        /** @var string */
        public string $name='',

        /** @description What kind of environment is this deployment */
        // @ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")
        /** @var Environments|null */
        public ?Environments $environment=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['environment'])) $this->environment = JsonConverters::from('Environments', $o['environment']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->environment)) $o['environment'] = JsonConverters::to('Environments', $this->environment);
        return empty($o) ? new class(){} : $o;
    }
}

PHP ValidateDeploymentName 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.

PATCH /api/deployments/validation/name HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tenantName":"String","name":"String","environment":"Lab","txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"isValid":true,"errors":[],"ruleSetsExecuted":["String"],"request":null}