public CloudFoundryClientV2(IOptions <CloudFoundryServicesOptions> cfOptions,
                             IOptions <CfServiceBinding> cfServiceOptions, ILogger <CloudFoundryClientV2> logger,
                             ISimpleHttpClient simpleHttpClient) : base(cfOptions, cfServiceOptions, logger)
 {
     SimpleHttp = simpleHttpClient;
     this.InitEndpoints();
 }
示例#2
0
 public SearchChecker(
     ISimpleHttpClient simpleHttpClient,
     string endpoint)
 {
     _simpleHttpClient = simpleHttpClient;
     _endpoint         = endpoint;
 }
示例#3
0
 public RegistrationHiveCopier(
     IRegistrationClient registrationClient,
     ISimpleHttpClient simpleHttpClient,
     ILogger <RegistrationHiveCopier> logger)
 {
     _registrationClient = registrationClient;
     _simpleHttpClient   = simpleHttpClient;
     _logger             = logger;
 }
示例#4
0
 public SearchChecker(
     ISimpleHttpClient simpleHttpClient,
     string endpoint,
     PortExpander portExpander)
 {
     _portExpander     = portExpander;
     _simpleHttpClient = simpleHttpClient;
     _endpoint         = endpoint;
 }
示例#5
0
 internal TorSharpToolFetcher(
     TorSharpSettings settings,
     HttpClient client,
     ISimpleHttpClient simpleHttpClient,
     IProgress <DownloadProgress> progress)
 {
     _settings         = settings;
     _simpleHttpClient = simpleHttpClient;
     _progress         = progress;
     _privoxyFetcher   = new PrivoxyFetcher(settings, client);
     _torFetcher       = new TorFetcher(settings, client);
 }
示例#6
0
        public static void Delete(this ISimpleHttpClient client, string url)
        {
            var task = Task.Factory.StartNew(() => client.Send <string>(HttpMethod.Delete, url));

            task.Wait();

            var responseCode = task.Result.Result.Response.StatusCode;

            if (responseCode != HttpStatusCode.OK)
            {
                throw new Exception($"Http return error {responseCode.ToString()}");
            }
        }
 public LoggregatorLog(IOptions <CFConfiguration> cfOPtions, ISimpleHttpClient simpleHttpClient,
                       ILoggregatorWebSocket webSocket, IProtobufSerializer protobufSerializer)
 {
     this.LoggregatorEndpoint = new Uri(cfOPtions?.Value?.LogAggregationUrl);
     if (!string.IsNullOrWhiteSpace(cfOPtions?.Value?.Proxy))
     {
         this.HttpProxy = new Uri(cfOPtions?.Value?.Proxy);
     }
     this.SkipCertificateValidation = (bool)cfOPtions?.Value?.SkipCertificateValidation;
     this.webSocket          = webSocket;
     this.protobufSerializer = protobufSerializer;
     httpClient = simpleHttpClient;
 }
示例#8
0
        public static void Put <T>(this ISimpleHttpClient client, string path, T postBody)
        {
            var task = Task.Factory.StartNew(() =>
                                             client.Send <string>(HttpMethod.Put, path, null, postBody));

            task.Wait();

            var responseCode = task.Result.Result.Response.StatusCode;

            if (responseCode != HttpStatusCode.OK)
            {
                throw new Exception($"Http return error {responseCode.ToString()}");
            }
        }
示例#9
0
        public static T Get <T>(this ISimpleHttpClient client, string path)
        {
            var task = Task.Factory.StartNew(() => client.Send <string>(HttpMethod.Get, path));

            task.Wait();

            var responseCode = task.Result.Result.Response.StatusCode;

            if (responseCode != HttpStatusCode.OK)
            {
                throw new Exception($"Http return error {responseCode.ToString()}");
            }
            return(JsonConvert.DeserializeObject <T>(task.Result.Result.Body));
        }
示例#10
0
        public async Task <bool> Connect(string serviceUri)
        {
            client = JsonHttpClient.Create(serviceUri + baseApiPath, AddAuthorization);

            try
            {
                var result = await client.Send <string>(HttpMethod.Get, "/");

                return(result.Response.StatusCode == HttpStatusCode.OK);
            }
            catch
            {
                return(false);
            }
        }
示例#11
0
 public RegistrationClient(ISimpleHttpClient simpleHttpClient)
 {
     _simpleHttpClient = simpleHttpClient ?? throw new ArgumentNullException(nameof(simpleHttpClient));
 }
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractUserProvidedServiceInstancesEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
 internal UserProvidedServiceInstancesEndpoint(CloudFoundryClientV2 client,
                                               ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractSecurityGroupRunningDefaultsEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractSecurityGroupsEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
 internal ServiceUsageEventsEndpoint(CloudFoundryClientV2 client,
                                     ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
示例#17
0
 internal StacksEndpoint(CloudFoundryClientV2 client,
                         ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
 internal ProcessesExperimentalEndpoint(CloudFoundryClientV3 client,
                                        ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
示例#19
0
 internal FeatureFlagsEndpoint(CloudFoundryClientV2 client,
                               ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
示例#20
0
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractFeatureFlagsEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
 protected BaseEndpoint(ISimpleHttpClient simpleHttpClient) => _httpClient = simpleHttpClient;
示例#22
0
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractBlobstoresEndpoint(ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
 }
 public TaskResourceEndPoint(CloudFoundryClientV3 client,
                             ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
示例#24
0
 internal ServicePlanVisibilitiesEndpoint(CloudFoundryClientV2 client,
                                          ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
示例#25
0
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractServicePlanVisibilitiesEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractProcessesExperimentalEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
示例#27
0
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractStacksEndpoint(ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
 }
 internal SecurityGroupRunningDefaultsEndpoint(CloudFoundryClientV2 client,
                                               ISimpleHttpClient simpleHttpClient) : base(simpleHttpClient)
 {
     this.Client = client;
 }
 /// <summary>
 /// Initializes the class
 /// </summary>
 protected AbstractServiceUsageEventsEndpoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }
 protected AbstractTaskResourceEndPoint(ISimpleHttpClient simpleHttpClient)
     : base(simpleHttpClient)
 {
 }