private Uri GetUri(string designDocName, DesignDocumentNamespace @namespace) { // {0}://{1}:{2}/{3}/_design var builder = new UriBuilder(_context.GetRandomNodeForService(ServiceType.KeyValue, _bucketName).ViewsUri) { Path = _bucketName }; if (!string.IsNullOrWhiteSpace(designDocName)) { const string devPrefix = "dev_"; string name; if (@namespace == DesignDocumentNamespace.Production) { name = designDocName.StartsWith(devPrefix) ? designDocName.Substring(devPrefix.Length) : designDocName; } else { name = designDocName.StartsWith(devPrefix) ? designDocName : string.Concat(devPrefix, designDocName); } builder.Path += $"/_design/{name}"; } return(builder.Uri); }
private Uri GetIndexUri(string indexName = null) { var node = _context.GetRandomNodeForService(ServiceType.Search); var builder = new UriBuilder(node.SearchUri) { Path = "api/index" }; if (!string.IsNullOrWhiteSpace(indexName)) { builder.Path += $"/{indexName}"; } return(builder.Uri); }