
Updated the .gitignore file to do a better job of ignoring bin,obj, and package folders. Partially implements blueprint initial-docs Change-Id: Ia5225027f5ad2972facabbbe5458b814ef09b6be
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
// /* ============================================================================
|
|
// Copyright 2014 Hewlett Packard
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
// ============================================================================ */
|
|
|
|
using System;
|
|
using System.Net.Http;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using OpenStack.Common.Http;
|
|
using OpenStack.Common.ServiceLocation;
|
|
|
|
namespace CustomServiceClientExample
|
|
{
|
|
internal class EchoRestClient : IEchoRestClient
|
|
{
|
|
internal const string serviceEndpoint = "http://httpbin.org/get";
|
|
|
|
internal IServiceLocator ServiceLocator;
|
|
|
|
public EchoRestClient(IServiceLocator serviceLocator)
|
|
{
|
|
this.ServiceLocator = serviceLocator;
|
|
}
|
|
|
|
public async Task<IHttpResponseAbstraction> Echo(string message)
|
|
{
|
|
var client = this.ServiceLocator.Locate<IHttpAbstractionClientFactory>().Create(CancellationToken.None);
|
|
client.Method = HttpMethod.Get;
|
|
client.Uri = new Uri(serviceEndpoint + "?m=" + message);
|
|
return await client.SendAsync();
|
|
}
|
|
}
|
|
}
|