| 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 'package:servicestack/servicestack.dart';
enum Severity
{
Error,
Warning,
Info,
}
class ValidationFailure implements IConvertible
{
String? propertyName;
String? errorMessage;
dynamic? attemptedValue;
dynamic? customState;
Severity severity;
List<dynamic>? formattedMessageArguments;
Map<String,dynamic?>? formattedMessagePlaceholderValues;
String? errorCode;
ValidationFailure({this.propertyName,this.errorMessage,this.attemptedValue,this.customState,this.severity,this.formattedMessageArguments,this.formattedMessagePlaceholderValues,this.errorCode});
ValidationFailure.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
propertyName = json['propertyName'];
errorMessage = json['errorMessage'];
attemptedValue = JsonConverters.fromJson(json['attemptedValue'],'dynamic',context!);
customState = JsonConverters.fromJson(json['customState'],'dynamic',context!);
severity = JsonConverters.fromJson(json['severity'],'Severity',context!);
formattedMessageArguments = JsonConverters.fromJson(json['formattedMessageArguments'],'List<dynamic>',context!);
formattedMessagePlaceholderValues = JsonConverters.fromJson(json['formattedMessagePlaceholderValues'],'Map<String,dynamic?>',context!);
errorCode = json['errorCode'];
return this;
}
Map<String, dynamic> toJson() => {
'propertyName': propertyName,
'errorMessage': errorMessage,
'attemptedValue': JsonConverters.toJson(attemptedValue,'dynamic',context!),
'customState': JsonConverters.toJson(customState,'dynamic',context!),
'severity': JsonConverters.toJson(severity,'Severity',context!),
'formattedMessageArguments': JsonConverters.toJson(formattedMessageArguments,'List<dynamic>',context!),
'formattedMessagePlaceholderValues': JsonConverters.toJson(formattedMessagePlaceholderValues,'Map<String,dynamic?>',context!),
'errorCode': errorCode
};
getTypeName() => "ValidationFailure";
TypeContext? context = _ctx;
}
abstract class IResponse
{
dynamic? originalResponse;
IRequest? request;
int statusCode = 0;
String? statusDescription;
String? contentType;
Uint8List? outputStream;
dynamic? dto;
bool useBufferedStream;
bool isClosed;
bool keepAlive;
bool hasStarted;
Map<String,dynamic?>? items;
}
// @flags()
class RequestAttributes
{
static const RequestAttributes None = const RequestAttributes._(0);
static const RequestAttributes Localhost = const RequestAttributes._(1);
static const RequestAttributes LocalSubnet = const RequestAttributes._(2);
static const RequestAttributes External = const RequestAttributes._(4);
static const RequestAttributes Secure = const RequestAttributes._(8);
static const RequestAttributes InSecure = const RequestAttributes._(16);
static const RequestAttributes AnySecurityMode = const RequestAttributes._(24);
static const RequestAttributes HttpHead = const RequestAttributes._(32);
static const RequestAttributes HttpGet = const RequestAttributes._(64);
static const RequestAttributes HttpPost = const RequestAttributes._(128);
static const RequestAttributes HttpPut = const RequestAttributes._(256);
static const RequestAttributes HttpDelete = const RequestAttributes._(512);
static const RequestAttributes HttpPatch = const RequestAttributes._(1024);
static const RequestAttributes HttpOptions = const RequestAttributes._(2048);
static const RequestAttributes HttpOther = const RequestAttributes._(4096);
static const RequestAttributes AnyHttpMethod = const RequestAttributes._(8160);
static const RequestAttributes OneWay = const RequestAttributes._(8192);
static const RequestAttributes Reply = const RequestAttributes._(16384);
static const RequestAttributes AnyCallStyle = const RequestAttributes._(24576);
static const RequestAttributes Soap11 = const RequestAttributes._(32768);
static const RequestAttributes Soap12 = const RequestAttributes._(65536);
static const RequestAttributes Xml = const RequestAttributes._(131072);
static const RequestAttributes Json = const RequestAttributes._(262144);
static const RequestAttributes Jsv = const RequestAttributes._(524288);
static const RequestAttributes ProtoBuf = const RequestAttributes._(1048576);
static const RequestAttributes Csv = const RequestAttributes._(2097152);
static const RequestAttributes Html = const RequestAttributes._(4194304);
static const RequestAttributes Jsonl = const RequestAttributes._(8388608);
static const RequestAttributes MsgPack = const RequestAttributes._(16777216);
static const RequestAttributes FormatOther = const RequestAttributes._(33554432);
static const RequestAttributes AnyFormat = const RequestAttributes._(67076096);
static const RequestAttributes Http = const RequestAttributes._(67108864);
static const RequestAttributes MessageQueue = const RequestAttributes._(134217728);
static const RequestAttributes Tcp = const RequestAttributes._(268435456);
static const RequestAttributes Grpc = const RequestAttributes._(536870912);
static const RequestAttributes EndpointOther = const RequestAttributes._(1073741824);
static const RequestAttributes AnyEndpoint = const RequestAttributes._(2080374784);
static const RequestAttributes InProcess = const RequestAttributes._(-2147483648);
static const RequestAttributes InternalNetworkAccess = const RequestAttributes._(-2147483645);
static const RequestAttributes AnyNetworkAccessType = const RequestAttributes._(-2147483641);
static const RequestAttributes Any = const RequestAttributes._(-1);
final int _value;
const RequestAttributes._(this._value);
int get value => _value;
static List<RequestAttributes> get values => const [None,Localhost,LocalSubnet,External,Secure,InSecure,AnySecurityMode,HttpHead,HttpGet,HttpPost,HttpPut,HttpDelete,HttpPatch,HttpOptions,HttpOther,AnyHttpMethod,OneWay,Reply,AnyCallStyle,Soap11,Soap12,Xml,Json,Jsv,ProtoBuf,Csv,Html,Jsonl,MsgPack,FormatOther,AnyFormat,Http,MessageQueue,Tcp,Grpc,EndpointOther,AnyEndpoint,InProcess,InternalNetworkAccess,AnyNetworkAccessType,Any];
}
abstract class IRequestPreferences
{
bool acceptsBrotli;
bool acceptsDeflate;
bool acceptsGzip;
}
abstract class IHttpFile
{
String? name;
String? fileName;
int contentLength = 0;
String? contentType;
Uint8List? inputStream;
}
abstract class IRequest
{
dynamic? originalRequest;
IResponse? response;
String? operationName;
String? verb;
RequestAttributes requestAttributes;
IRequestPreferences? requestPreferences;
dynamic? dto;
String? contentType;
bool isLocal;
String? userAgent;
Map<String,Cookie?>? cookies;
String? responseContentType;
bool hasExplicitResponseContentType;
Map<String,dynamic?>? items;
NameValueCollection? headers;
NameValueCollection? queryString;
NameValueCollection? formData;
bool useBufferedStream;
String? rawUrl;
String? absoluteUri;
String? userHostAddress;
String? remoteIp;
String? authorization;
bool isSecureConnection;
List<String>? acceptTypes;
String? pathInfo;
String? originalPathInfo;
Uint8List? inputStream;
int contentLength = 0;
List<IHttpFile>? files;
Uri? urlReferrer;
}
class ValidationResult implements IConvertible
{
bool isValid;
List<ValidationFailure>? errors;
List<String>? ruleSetsExecuted;
IRequest? request;
ValidationResult({this.isValid,this.errors,this.ruleSetsExecuted,this.request});
ValidationResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
isValid = json['isValid'];
errors = JsonConverters.fromJson(json['errors'],'List<ValidationFailure>',context!);
ruleSetsExecuted = JsonConverters.fromJson(json['ruleSetsExecuted'],'List<String>',context!);
request = JsonConverters.fromJson(json['request'],'IRequest',context!);
return this;
}
Map<String, dynamic> toJson() => {
'isValid': isValid,
'errors': JsonConverters.toJson(errors,'List<ValidationFailure>',context!),
'ruleSetsExecuted': JsonConverters.toJson(ruleSetsExecuted,'List<String>',context!),
'request': JsonConverters.toJson(request,'IRequest',context!)
};
getTypeName() => "ValidationResult";
TypeContext? context = _ctx;
}
enum Environments
{
Lab,
Poc,
Dev,
Test,
Int,
Uat,
Prod,
}
/**
* 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)
class ValidateDeploymentName implements IBaseRequest, IHasTenantName, IPatch, IConvertible
{
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
String tenantName = "";
/**
* 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]+)$′)")
String name = "";
/**
* What kind of environment is this deployment
*/
// @ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")
Environments environment;
ValidateDeploymentName({this.tenantName,this.name,this.environment});
ValidateDeploymentName.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
tenantName = json['tenantName'];
name = json['name'];
environment = JsonConverters.fromJson(json['environment'],'Environments',context!);
return this;
}
Map<String, dynamic> toJson() => {
'tenantName': tenantName,
'name': name,
'environment': JsonConverters.toJson(environment,'Environments',context!)
};
getTypeName() => "ValidateDeploymentName";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'duneframework.com', types: <String, TypeInfo> {
'Severity': TypeInfo(TypeOf.Enum, enumValues:Severity.values),
'ValidationFailure': TypeInfo(TypeOf.Class, create:() => ValidationFailure()),
'List<dynamic>': TypeInfo(TypeOf.Class, create:() => <dynamic>[]),
'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
'IResponse': TypeInfo(TypeOf.Interface),
'RequestAttributes': TypeInfo(TypeOf.Enum, enumValues:RequestAttributes.values),
'IRequestPreferences': TypeInfo(TypeOf.Interface),
'IHttpFile': TypeInfo(TypeOf.Interface),
'IRequest': TypeInfo(TypeOf.Interface),
'ValidationResult': TypeInfo(TypeOf.Class, create:() => ValidationResult()),
'List<ValidationFailure>': TypeInfo(TypeOf.Class, create:() => <ValidationFailure>[]),
'Environments': TypeInfo(TypeOf.Enum, enumValues:Environments.values),
'ValidateDeploymentName': TypeInfo(TypeOf.Class, create:() => ValidateDeploymentName()),
});
Dart 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}