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
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
Object = TypeVar('Object')


class Severity(str, Enum):
    ERROR = 'Error'
    WARNING = 'Warning'
    INFO = 'Info'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ValidationFailure:
    property_name: Optional[str] = None
    error_message: Optional[str] = None
    attempted_value: Optional[Object] = None
    custom_state: Optional[Object] = None
    severity: Optional[Severity] = None
    formatted_message_arguments: Optional[List[Object]] = None
    formatted_message_placeholder_values: Optional[Dict[str, Object]] = None
    error_code: Optional[str] = None


class IResponse:
    original_response: Optional[Object] = None
    request: Optional[IRequest] = None
    status_code: int = 0
    status_description: Optional[str] = None
    content_type: Optional[str] = None
    output_stream: Optional[bytes] = None
    dto: Optional[Object] = None
    use_buffered_stream: bool = False
    is_closed: bool = False
    keep_alive: bool = False
    has_started: bool = False
    items: Optional[Dict[str, Object]] = None


# @Flags()
class RequestAttributes(IntEnum):
    NONE = 0
    LOCALHOST = 1
    LOCAL_SUBNET = 2
    EXTERNAL = 4
    SECURE = 8
    IN_SECURE = 16
    ANY_SECURITY_MODE = 24
    HTTP_HEAD = 32
    HTTP_GET = 64
    HTTP_POST = 128
    HTTP_PUT = 256
    HTTP_DELETE = 512
    HTTP_PATCH = 1024
    HTTP_OPTIONS = 2048
    HTTP_OTHER = 4096
    ANY_HTTP_METHOD = 8160
    ONE_WAY = 8192
    REPLY = 16384
    ANY_CALL_STYLE = 24576
    SOAP11 = 32768
    SOAP12 = 65536
    XML = 131072
    JSON = 262144
    JSV = 524288
    PROTO_BUF = 1048576
    CSV = 2097152
    HTML = 4194304
    JSONL = 8388608
    MSG_PACK = 16777216
    FORMAT_OTHER = 33554432
    ANY_FORMAT = 67076096
    HTTP = 67108864
    MESSAGE_QUEUE = 134217728
    TCP = 268435456
    GRPC = 536870912
    ENDPOINT_OTHER = 1073741824
    ANY_ENDPOINT = 2080374784
    IN_PROCESS = -2147483648
    INTERNAL_NETWORK_ACCESS = -2147483645
    ANY_NETWORK_ACCESS_TYPE = -2147483641
    ANY = -1


class IRequestPreferences:
    accepts_brotli: bool = False
    accepts_deflate: bool = False
    accepts_gzip: bool = False


class IHttpFile:
    name: Optional[str] = None
    file_name: Optional[str] = None
    content_length: int = 0
    content_type: Optional[str] = None
    input_stream: Optional[bytes] = None


class IRequest:
    original_request: Optional[Object] = None
    response: Optional[IResponse] = None
    operation_name: Optional[str] = None
    verb: Optional[str] = None
    request_attributes: Optional[RequestAttributes] = None
    request_preferences: Optional[IRequestPreferences] = None
    dto: Optional[Object] = None
    content_type: Optional[str] = None
    is_local: bool = False
    user_agent: Optional[str] = None
    cookies: Optional[Dict[str, Cookie]] = None
    response_content_type: Optional[str] = None
    has_explicit_response_content_type: bool = False
    items: Optional[Dict[str, Object]] = None
    headers: Optional[NameValueCollection] = None
    query_string: Optional[NameValueCollection] = None
    form_data: Optional[NameValueCollection] = None
    use_buffered_stream: bool = False
    raw_url: Optional[str] = None
    absolute_uri: Optional[str] = None
    user_host_address: Optional[str] = None
    remote_ip: Optional[str] = None
    authorization: Optional[str] = None
    is_secure_connection: bool = False
    accept_types: Optional[List[str]] = None
    path_info: Optional[str] = None
    original_path_info: Optional[str] = None
    input_stream: Optional[bytes] = None
    content_length: int = 0
    files: Optional[List[IHttpFile]] = None
    url_referrer: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ValidationResult:
    is_valid: bool = False
    errors: Optional[IList[ValidationFailure]] = None
    rule_sets_executed: Optional[List[str]] = None
    request: Optional[IRequest] = None


class Environments(str, Enum):
    LAB = 'Lab'
    POC = 'Poc'
    DEV = 'Dev'
    TEST = 'Test'
    INT_ = 'Int'
    UAT = 'Uat'
    PROD = 'Prod'


# @Api(Description="Validate deployment name with the user defined part")
# @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(ValidationResult), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ValidateDeploymentName(IBaseRequest, IHasTenantName, IPatch):
    """
    Validate deployment name with the user defined part
    """

    # @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    # @Validate(Validator="NotEmpty")
    tenant_name: Optional[str] = None

    # @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]+)$′)")
    name: Optional[str] = None
    """
    The full name in the form of '{userdefined}_{environment}'
    """


    # @ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")
    environment: Optional[Environments] = None
    """
    What kind of environment is this deployment
    """

Python 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}