| 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 |
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using CoreService.ServiceModel.Dtos.Deployments.Crud;
using CoreService.ServiceModel.Enums;
using ServiceStack.FluentValidation.Results;
using ServiceStack.FluentValidation;
using ServiceStack.Web;
namespace CoreService.ServiceModel.Dtos.Deployments.Crud
{
///<summary>
///Validate deployment name with the user defined part
///</summary>
[Api(Description="Validate deployment name with the user defined part")]
[ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(ServiceStack.FluentValidation.Results.ValidationResult), StatusCode=200)]
public partial class ValidateDeploymentName
: IBaseRequest, IHasTenantName, IPatch
{
[ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
[Validate("NotEmpty")]
public virtual string TenantName { get; set; }
///<summary>
///The full name in the form of '{userdefined}_{environment}'
///</summary>
[ApiMember(DataType="string", Description="The full name in the form of '{userdefined}_{environment}'", IsRequired=true, ParameterType="body")]
[Validate("NotEmpty")]
[Validate("MaximumLength(100)")]
[Validate("RegularExpression(′^([0-9a-z]+[0-9a-z-]*[0-9a-z]+)_([a-z]+)$′)")]
public virtual string Name { get; set; }
///<summary>
///What kind of environment is this deployment
///</summary>
[ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")]
public virtual Environments Environment { get; set; }
}
}
namespace CoreService.ServiceModel.Enums
{
public enum Environments
{
Lab,
Poc,
Dev,
Test,
Int,
Uat,
Prod,
}
}
namespace ServiceStack
{
[Flags]
public enum RequestAttributes
{
None = 0,
Localhost = 1,
LocalSubnet = 2,
External = 4,
Secure = 8,
InSecure = 16,
AnySecurityMode = 24,
HttpHead = 32,
HttpGet = 64,
HttpPost = 128,
HttpPut = 256,
HttpDelete = 512,
HttpPatch = 1024,
HttpOptions = 2048,
HttpOther = 4096,
AnyHttpMethod = 8160,
OneWay = 8192,
Reply = 16384,
AnyCallStyle = 24576,
Soap11 = 32768,
Soap12 = 65536,
Xml = 131072,
Json = 262144,
Jsv = 524288,
ProtoBuf = 1048576,
Csv = 2097152,
Html = 4194304,
Jsonl = 8388608,
MsgPack = 16777216,
FormatOther = 33554432,
AnyFormat = 67076096,
Http = 67108864,
MessageQueue = 134217728,
Tcp = 268435456,
Grpc = 536870912,
EndpointOther = 1073741824,
AnyEndpoint = 2080374784,
InProcess = -2147483648,
InternalNetworkAccess = -2147483645,
AnyNetworkAccessType = -2147483641,
Any = -1,
}
}
namespace ServiceStack.FluentValidation
{
public enum Severity
{
Error,
Warning,
Info,
}
}
namespace ServiceStack.FluentValidation.Results
{
public partial class ValidationFailure
{
public virtual string? PropertyName { get; set; }
public virtual string? ErrorMessage { get; set; }
public virtual Object? AttemptedValue { get; set; }
public virtual Object? CustomState { get; set; }
public virtual Severity Severity { get; set; }
public virtual Object[]? FormattedMessageArguments { get; set; }
public virtual Dictionary<string, Object>? FormattedMessagePlaceholderValues { get; set; }
public virtual string? ErrorCode { get; set; }
}
public partial class ValidationResult
{
public virtual bool IsValid { get; set; }
public virtual IList<ValidationFailure>? Errors { get; set; }
public virtual string[]? RuleSetsExecuted { get; set; }
public virtual IRequest? Request { get; set; }
}
}
namespace ServiceStack.Web
{
public partial interface IHttpFile
{
string? Name { get; set; }
string? FileName { get; set; }
long ContentLength { get; set; }
string? ContentType { get; set; }
Stream? InputStream { get; set; }
}
public partial interface IRequest
{
Object? OriginalRequest { get; set; }
IResponse? Response { get; set; }
string? OperationName { get; set; }
string? Verb { get; set; }
RequestAttributes RequestAttributes { get; set; }
IRequestPreferences? RequestPreferences { get; set; }
Object? Dto { get; set; }
string? ContentType { get; set; }
bool IsLocal { get; set; }
string? UserAgent { get; set; }
IDictionary<string, Cookie>? Cookies { get; set; }
string? ResponseContentType { get; set; }
bool HasExplicitResponseContentType { get; set; }
Dictionary<string, Object>? Items { get; set; }
NameValueCollection? Headers { get; set; }
NameValueCollection? QueryString { get; set; }
NameValueCollection? FormData { get; set; }
bool UseBufferedStream { get; set; }
string? RawUrl { get; set; }
string? AbsoluteUri { get; set; }
string? UserHostAddress { get; set; }
string? RemoteIp { get; set; }
string? Authorization { get; set; }
bool IsSecureConnection { get; set; }
string[]? AcceptTypes { get; set; }
string? PathInfo { get; set; }
string? OriginalPathInfo { get; set; }
Stream? InputStream { get; set; }
long ContentLength { get; set; }
IHttpFile[]? Files { get; set; }
Uri? UrlReferrer { get; set; }
}
public partial interface IRequestPreferences
{
bool AcceptsBrotli { get; set; }
bool AcceptsDeflate { get; set; }
bool AcceptsGzip { get; set; }
}
public partial interface IResponse
{
Object? OriginalResponse { get; set; }
IRequest? Request { get; set; }
int StatusCode { get; set; }
string? StatusDescription { get; set; }
string? ContentType { get; set; }
Stream? OutputStream { get; set; }
Object? Dto { get; set; }
bool UseBufferedStream { get; set; }
bool IsClosed { get; set; }
bool KeepAlive { get; set; }
bool HasStarted { get; set; }
Dictionary<string, Object>? Items { get; set; }
}
}
C# 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}