internal static string ValidateAndGetImage(string image, INestedEdgeParentUriParser parser) { image = Preconditions.CheckNonWhiteSpace(image, nameof(image)).Trim(); if (image[0] == '$') { image = parser.ParseURI(image) .Expect(() => new ArgumentException($"Image {image} is not in the right format.If your intention is to use an environment variable, check the port is specified.")); } Match match = ImageRegex.Match(image); if (match.Success) { if (match.Groups["tag"]?.Length > 0) { return(image); } else { return(Invariant($"{image}:{Constants.DefaultTag}")); } } else { throw new ArgumentException($"Image {image} is not in the right format"); } }
public ModuleLogsUploadRequest( string schemaVersion, List <LogRequestItem> items, LogsContentEncoding encoding, LogsContentType contentType, string sasUrl, INestedEdgeParentUriParser parser) { this.SchemaVersion = Preconditions.CheckNonWhiteSpace(schemaVersion, nameof(schemaVersion)); this.Encoding = encoding; this.ContentType = contentType; this.Items = Preconditions.CheckNotNull(items, nameof(items)); this.SasUrl = Preconditions.CheckNotNull(sasUrl, nameof(sasUrl)); Option <string> url = parser.ParseURI(this.SasUrl); this.SasUrl = url.GetOrElse(this.SasUrl); }
public SupportBundleRequest(string schemaVersion, string sasUrl, string since, string until, bool?edgeRuntimeOnly, INestedEdgeParentUriParser parser) { this.SchemaVersion = Preconditions.CheckNonWhiteSpace(schemaVersion, nameof(schemaVersion)); this.SasUrl = Preconditions.CheckNotNull(sasUrl, nameof(sasUrl)); this.Since = Option.Maybe(since); this.Until = Option.Maybe(until); this.EdgeRuntimeOnly = Option.Maybe(edgeRuntimeOnly); Option <string> url = parser.ParseURI(this.SasUrl); this.SasUrl = url.GetOrElse(this.SasUrl); }