Exemplo n.º 1
0
        Uri BuildUriForLocksRoute(string key, SettingFilter filter)
        {
            var builder = new UriBuilder(_baseUri);

            builder.Path = LocksRoute + key;

            if (filter != null && filter.Label != null)
            {
                builder.AppendQuery(LabelQueryFilter, filter.Label);
            }

            return(builder.Uri);
        }
Exemplo n.º 2
0
        public async Task <Response <ConfigurationSetting> > DeleteAsync(string key, SettingFilter filter = null, CancellationToken cancellation = default)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            Uri uri = BuildUrlForKvRoute(key, filter);

            using (PipelineCallContext context = Pipeline.CreateContext(_options, cancellation))
            {
                context.SetRequestLine(ServiceMethod.Delete, uri);

                context.AddHeader("Host", uri.Host);
                AddFilterHeaders(filter, context);
                AddAuthenticationHeaders(context, uri, ServiceMethod.Delete, content: default, _secret, _credential);
Exemplo n.º 3
0
        // TODO (pri 3): do all the methods that call this accept revisions?
        static void AddFilterHeaders(SettingFilter filter, PipelineCallContext context)
        {
            if (filter == null)
            {
                return;
            }

            if (filter.ETag.IfMatch != default)
            {
                context.AddHeader(IfMatchName, $"\"{filter.ETag.IfMatch}\"");
            }

            if (filter.Revision.HasValue)
            {
                var dateTime = filter.Revision.Value.UtcDateTime.ToString(AcceptDateTimeFormat);
                context.AddHeader(AcceptDatetimeHeader, dateTime);
            }
        }