| Required role: | TenantReader |
| PATCH | /api/deployments/validation/name | Validate deployment name with the user defined part | |
|---|---|---|---|
| PATCH | /deployments/validation/name | Validate deployment name with the user defined part |
import Foundation
import ServiceStack
/**
* 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(ValidationResult), StatusCode=200)
public class ValidateDeploymentName : IBaseRequest, IHasTenantName, IPatch, Codable
{
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
public var tenantName:String
/**
* 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]+)$′)")
public var name:String
/**
* What kind of environment is this deployment
*/
// @ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")
public var environment:Environments
required public init(){}
}
public enum Environments : String, Codable
{
case Lab
case Poc
case Dev
case Test
case Int
case Uat
case Prod
}
public class ValidationResult : Codable
{
public var isValid:Bool
public var errors:IList<ValidationFailure>
public var ruleSetsExecuted:[String]
//request:IRequest ignored. Swift doesn't support interface properties
required public init(){}
}
public class ValidationFailure : Codable
{
public var propertyName:String
public var errorMessage:String
public var attemptedValue:String
public var customState:String
public var severity:Severity
public var formattedMessageArguments:[String]
public var formattedMessagePlaceholderValues:[String:String]
public var errorCode:String
required public init(){}
}
public enum Severity : String, Codable
{
case Error
case Warning
case Info
}
public protocol IRequest
{
var originalRequest:String { get set }
//response:IResponse ignored. Swift doesn't support interface properties
var operationName:String { get set }
var verb:String { get set }
var requestAttributes:RequestAttributes { get set }
//requestPreferences:IRequestPreferences ignored. Swift doesn't support interface properties
var dto:String { get set }
var contentType:String { get set }
var isLocal:Bool { get set }
var userAgent:String { get set }
var cookies:[String:Cookie] { get set }
var responseContentType:String { get set }
var hasExplicitResponseContentType:Bool { get set }
var items:[String:String] { get set }
var headers:NameValueCollection { get set }
var queryString:NameValueCollection { get set }
var formData:NameValueCollection { get set }
var useBufferedStream:Bool { get set }
var rawUrl:String { get set }
var absoluteUri:String { get set }
var userHostAddress:String { get set }
var remoteIp:String { get set }
var authorization:String { get set }
var isSecureConnection:Bool { get set }
var acceptTypes:[String] { get set }
var pathInfo:String { get set }
var originalPathInfo:String { get set }
var inputStream:Data { get set }
var contentLength:Int { get set }
var files:[IHttpFile] { get set }
var urlReferrer:Uri { get set }
}
public protocol IResponse
{
var originalResponse:String { get set }
//request:IRequest ignored. Swift doesn't support interface properties
var statusCode:Int { get set }
var statusDescription:String { get set }
var contentType:String { get set }
var outputStream:Data { get set }
var dto:String { get set }
var useBufferedStream:Bool { get set }
var isClosed:Bool { get set }
var keepAlive:Bool { get set }
var hasStarted:Bool { get set }
var items:[String:String] { get set }
}
// @Flags()
public enum RequestAttributes : Int, Codable
{
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
}
public protocol IRequestPreferences
{
var acceptsBrotli:Bool { get set }
var acceptsDeflate:Bool { get set }
var acceptsGzip:Bool { get set }
}
public protocol IHttpFile
{
var name:String { get set }
var fileName:String { get set }
var contentLength:Int { get set }
var contentType:String { get set }
var inputStream:Data { get set }
}
Swift 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
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}