예제 #1
0
        T CreateScannerInternal <T>(ScannerOptions options, Func <Method, string, string, string, string, HttpStatusCode[], T> action)
        {
            string resource = ResourceBuilder.BuildScannerCreate(options);

            return(action(Method.PUT, resource, HBaseMimeTypes.Xml, null, ScannerConverter.Convert(options), new[] { HttpStatusCode.Created }));
        }
예제 #2
0
        /// <summary>
        ///   Creates the scanner.
        /// </summary>
        /// <param name="options">The options.</param>
        public virtual IScanner CreateScanner(ScannerOptions options)
        {
            string        resource = ResourceBuilder.BuildScannerCreate(options);
            IRestResponse response = SendRequest(Method.PUT, resource, HBaseMimeTypes.Xml, content: ScannerConverter.Convert(options));

            ErrorProvider.ThrowIfStatusMismatch(response, HttpStatusCode.Created);
            string scannerLocation =
                response.Headers.Where(header => header.Type == ParameterType.HttpHeader && header.Name == RestConstants.LocationHeader)
                .Select(header => header.Value.ToString())
                .FirstOrDefault();

            return(string.IsNullOrEmpty(scannerLocation) ? null : new Scanner(options.TableName, new Uri(scannerLocation).PathAndQuery.Trim('/'), this));
        }