CoreService

<back to all web services

GenerateDeploymentName

Deployment - CRUD

Generate deployment name with the user defined part

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
PATCH/api/deployments/generation/nameGenerate deployment name with the user defined part
PATCH/deployments/generation/nameGenerate 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 Environments : string
{
    case Lab = 'Lab';
    case Poc = 'Poc';
    case Dev = 'Dev';
    case Test = 'Test';
    case Int = 'Int';
    case Uat = 'Uat';
    case Prod = 'Prod';
}

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

        /** @description User defined/custom part of the name */
        // @ApiMember(DataType="string", Description="User defined/custom part of the name", IsRequired=true, ParameterType="body")
        // @Validate(Validator="NotEmpty")
        // @Validate(Validator="MaximumLength(100)")
        // @Validate(Validator="RegularExpression(′^[0-9a-z]+[0-9a-z-]*[0-9a-z]+$′)")
        /** @var string */
        public string $userDefinedPart='',

        /** @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['userDefinedPart'])) $this->userDefinedPart = $o['userDefinedPart'];
        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->userDefinedPart)) $o['userDefinedPart'] = $this->userDefinedPart;
        if (isset($this->environment)) $o['environment'] = JsonConverters::to('Environments', $this->environment);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GenerateDeploymentName 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/generation/name HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

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

(string)