コード例 #1
0
 web::http::http_request get_service_stats(web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
 {
     uri_builder.append_query(uri_query_resource_type, resource_service);
     uri_builder.append_query(uri_query_component, component_stats);
     web::http::http_request request(base_request(web::http::methods::GET, uri_builder, timeout, context));
     return request;
 }
コード例 #2
0
    web::http::http_request delete_message(const cloud_queue& queue, const cloud_queue_message& message, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        uri_builder.append_query(U("popreceipt"), message.pop_receipt());

        web::http::http_request request = queue_base_request(web::http::methods::DEL, uri_builder, timeout, context);
        return request;
    }
コード例 #3
0
 web::http::http_request set_service_properties(web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
 {
     uri_builder.append_query(core::make_query_parameter(uri_query_resource_type, resource_service, /* do_encoding */ false));
     uri_builder.append_query(core::make_query_parameter(uri_query_component, component_properties, /* do_encoding */ false));
     web::http::http_request request(base_request(web::http::methods::PUT, uri_builder, timeout, context));
     return request;
 }
コード例 #4
0
    web::http::http_request update_message(const cloud_queue& queue, const cloud_queue_message& message, std::chrono::seconds visibility_timeout, bool update_contents, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        uri_builder.append_query(U("popreceipt"), message.pop_receipt());
        uri_builder.append_query(U("visibilitytimeout"), visibility_timeout.count());

        web::http::http_request request = queue_base_request(web::http::methods::PUT, uri_builder, timeout, context);

        if (update_contents)
        {
            protocol::message_writer writer;
            std::string content = writer.write(message.content_as_string());
            request.set_body(content);
        }

        return request;
    }
コード例 #5
0
    web::http::http_request update_message(const cloud_queue_message& message, std::chrono::seconds visibility_timeout, bool update_contents, web::http::uri_builder& uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        uri_builder.append_query(core::make_query_parameter(_XPLATSTR("popreceipt"), message.pop_receipt()));
        uri_builder.append_query(core::make_query_parameter(_XPLATSTR("visibilitytimeout"), visibility_timeout.count(), /* do_encoding */ false));

        web::http::http_request request = queue_base_request(web::http::methods::PUT, uri_builder, timeout, context);

        if (update_contents)
        {
            protocol::message_writer writer;
            std::string content = writer.write(message);
            request.set_body(content);
        }

        return request;
    }
コード例 #6
0
    web::http::http_request list_queues(web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        uri_builder.append_query(uri_query_component, component_list);

        web::http::http_request request = queue_base_request(web::http::methods::GET, uri_builder, timeout, context);
        return request;
    }
コード例 #7
0
    web::http::http_request list_queues(web::http::uri_builder& uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        uri_builder.append_query(core::make_query_parameter(uri_query_component, component_list, /* do_encoding */ false));

        web::http::http_request request = queue_base_request(web::http::methods::GET, uri_builder, timeout, context);
        return request;
    }
コード例 #8
0
 void add_query_if_not_empty(web::http::uri_builder& builder, const utility::string_t& name, const utility::string_t& value, bool do_encoding)
 {
     if (!value.empty())
     {
         builder.append_query(core::make_query_parameter(name, value, do_encoding));
     }
 }
コード例 #9
0
 web::http::http_request upload_queue_metadata(const cloud_queue& queue, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
 {
     // TODO: Make a copy of needed data so it is OK for the main object class to be destructed mid-operation
     uri_builder.append_query(uri_query_component, component_metadata);
     web::http::http_request request = queue_base_request(web::http::methods::PUT, uri_builder, timeout, context);
     add_metadata(request, queue.metadata());
     return request;
 }
コード例 #10
0
    web::http::http_request add_message(const cloud_queue& queue, const cloud_queue_message& message, std::chrono::seconds time_to_live, std::chrono::seconds initial_visibility_timeout, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        if (time_to_live.count() >= 0LL && time_to_live.count() != 604800LL)
        {
            uri_builder.append_query(U("messagettl"), time_to_live.count());
        }

        if (initial_visibility_timeout.count() > 0LL)
        {
            uri_builder.append_query(U("visibilitytimeout"), initial_visibility_timeout.count());
        }

        web::http::http_request request = queue_base_request(web::http::methods::POST, uri_builder, timeout, context);

        protocol::message_writer writer;
        std::string content = writer.write(message.content_as_string());
        request.set_body(content);

        return request;
    }
コード例 #11
0
    web::http::http_request base_request(web::http::method method, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        if (timeout.count() > 0)
        {
            uri_builder.append_query(core::make_query_parameter(uri_query_timeout, timeout.count(), /* do_encoding */ false));
        }

        web::http::http_request request(method);
        request.set_request_uri(uri_builder.to_uri());

        web::http::http_headers& headers = request.headers();
        headers.add(web::http::header_names::user_agent, header_value_user_agent);
        headers.add(ms_header_version, header_value_storage_version);

        if (method == web::http::methods::PUT)
        {
            headers.set_content_length(0);
        }

        return request;
    }
コード例 #12
0
    web::http::http_request get_messages(const cloud_queue& queue, size_t message_count, std::chrono::seconds visibility_timeout, bool is_peek, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        if (is_peek)
        {
            uri_builder.append_query(U("peekonly=true"));
        }

        if (message_count > 1U)
        {
            // The service uses the default value 1
            uri_builder.append_query(U("numofmessages"), message_count);
        }

        if (!is_peek && visibility_timeout.count() > 0LL)
        {
            uri_builder.append_query(U("visibilitytimeout"), visibility_timeout.count());
        }

        web::http::http_request request = queue_base_request(web::http::methods::GET, uri_builder, timeout, context);
        return request;
    }
コード例 #13
0
    web::http::http_request get_messages(size_t message_count, std::chrono::seconds visibility_timeout, bool is_peek, web::http::uri_builder& uri_builder, const std::chrono::seconds& timeout, operation_context context)
    {
        if (is_peek)
        {
            uri_builder.append_query(_XPLATSTR("peekonly=true"));
        }

        if (message_count > 1U)
        {
            // The service uses the default value 1
            uri_builder.append_query(core::make_query_parameter(_XPLATSTR("numofmessages"), message_count, /* do_encoding */ false));
        }

        if (!is_peek && visibility_timeout.count() > 0LL)
        {
            uri_builder.append_query(core::make_query_parameter(_XPLATSTR("visibilitytimeout"), visibility_timeout.count(), /* do_encoding */ false));
        }

        web::http::http_request request = queue_base_request(web::http::methods::GET, uri_builder, timeout, context);
        return request;
    }
コード例 #14
0
 web::http::http_request download_queue_metadata(const cloud_queue& queue, web::http::uri_builder uri_builder, const std::chrono::seconds& timeout, operation_context context)
 {
     uri_builder.append_query(uri_query_component, component_metadata);
     web::http::http_request request = queue_base_request(web::http::methods::HEAD, uri_builder, timeout, context);
     return request;
 }
コード例 #15
0
pplx::task<etcd::Response> etcd::Client::send_get_request(web::http::uri_builder & uri)
{
  return Response::create(client.request(web::http::methods::GET, uri.to_string()));
}
コード例 #16
0
pplx::task<etcd::Response> etcd::Client::send_put_request(web::http::uri_builder & uri, std::string const & key, std::string const & value)
{
  std::string data = key + "=" + value;
  std::string content_type = "application/x-www-form-urlencoded; param=" + key;
  return Response::create(client.request(web::http::methods::PUT, uri.to_string(), data.c_str(), content_type.c_str()));
}