Skip to content

Commit f922f0c

Browse files
authored
Merge pull request #3 from ThreeMammals/master
Master merge
2 parents cbb21a1 + b280b1c commit f922f0c

File tree

103 files changed

+3101
-1578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3101
-1578
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
[<img src="https://threemammals.com/ocelot_logo.png">](https://threemammals.com/ocelot)
1+
[<img src="https://threemammals.com/images/ocelot_logo.png">](https://threemammals.com/ocelot)
22

33
[![CircleCI](https://circleci.com/gh/ThreeMammals/Ocelot/tree/master.svg?style=svg)](https://circleci.com/gh/ThreeMammals/Ocelot/tree/master)
44

55
[![Coverage Status](https://coveralls.io/repos/github/ThreeMammals/Ocelot/badge.svg?branch=master)](https://coveralls.io/github/ThreeMammals/Ocelot?branch=master)
66

7-
[Slack](threemammals.slack.com)
7+
[Slack](https://threemammals.slack.com)
88

99
# Ocelot
1010

@@ -48,7 +48,7 @@ A quick list of Ocelot's capabilities for more information see the [documentatio
4848
* Retry policies / QoS
4949
* Load Balancing
5050
* Logging / Tracing / Correlation
51-
* Headers / Query String / Claims Transformation
51+
* Headers / Method / Query String / Claims Transformation
5252
* Custom Middleware / Delegating Handlers
5353
* Configuration / Administration REST API
5454
* Platform / Cloud Agnostic

build.cake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,12 @@ Task("RunUnitTests")
134134
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.opencover.xml"));
135135
Information(coverageSummaryFile);
136136
Information(artifactsForUnitTestsDir);
137+
137138
// todo bring back report generator to get a friendly report
138139
// ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
139140
// https://github.com/danielpalme/ReportGenerator
140-
141-
if (IsRunningOnCircleCI())
141+
142+
if (IsRunningOnCircleCI() && IsMaster())
142143
{
143144
var repoToken = EnvironmentVariable(coverallsRepoToken);
144145
if (string.IsNullOrEmpty(repoToken))
@@ -497,4 +498,9 @@ private string GetResource(string url)
497498
private bool IsRunningOnCircleCI()
498499
{
499500
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
501+
}
502+
503+
private bool IsMaster()
504+
{
505+
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "master";
500506
}

docs/features/configuration.rst

Lines changed: 287 additions & 230 deletions
Large diffs are not rendered by default.

docs/features/kubernetes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Then add the following to your ConfigureServices method.
1414
s.AddOcelot()
1515
.AddKubernetes();
1616
17-
If you have services deployed in kubernetes you will normally use the naming service to access them. Default usePodServiceAccount = True, which means that ServiceAccount using Pod to access the service of the k8s cluster needs to be ServiceAccount based on RABC authorization
17+
If you have services deployed in kubernetes you will normally use the naming service to access them. Default usePodServiceAccount = True, which means that ServiceAccount using Pod to access the service of the k8s cluster needs to be ServiceAccount based on RBAC authorization
1818

1919
.. code-block::csharp
2020
public static class OcelotBuilderExtensions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
HTTP Method Transformation
2+
==========================
3+
4+
Ocelot allows the user to change the HTTP request method that will be used when making a request to a downstream service.
5+
6+
This achieved by setting the following ReRoute configuration:
7+
8+
.. code-block:: json
9+
10+
{
11+
"DownstreamPathTemplate": "/{url}",
12+
"UpstreamPathTemplate": "/{url}",
13+
"UpstreamHttpMethod": [
14+
"Get"
15+
],
16+
"DownstreamHttpMethod": "POST",
17+
"DownstreamScheme": "http",
18+
"DownstreamHostAndPorts": [
19+
{
20+
"Host": "localhost",
21+
"Port": 53271
22+
}
23+
],
24+
}
25+
26+
The key property here is DownstreamHttpMethod which is set as POST and the ReRoute will only match on GET as set by UpstreamHttpMethod.
27+
28+
This feature can be useful when interacting with downstream apis that only support POST and you want to present some kind of RESTful interface.

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Thanks for taking a look at the Ocelot documentation. Please use the left hand n
2323
features/requestaggregation
2424
features/graphql
2525
features/servicediscovery
26-
features/servicefabric
26+
features/servicefabric
2727
features/kubernetes
2828
features/authentication
2929
features/authorisation
@@ -33,6 +33,7 @@ Thanks for taking a look at the Ocelot documentation. Please use the left hand n
3333
features/caching
3434
features/qualityofservice
3535
features/headerstransformation
36+
features/methodtransformation
3637
features/claimstransformation
3738
features/logging
3839
features/tracing
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
33
<TargetFramework>netcoreapp3.1</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6-
<Folder Include="wwwroot\"/>
6+
<Folder Include="wwwroot\" />
77
</ItemGroup>
88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.App"/>
10-
<PackageReference Include="Ocelot" Version="12.0.1"/>
11-
<PackageReference Include="Ocelot.Administration" Version="0.1.0"/>
9+
<PackageReference Include="Ocelot" Version="14.0.3" />
10+
<PackageReference Include="Ocelot.Administration" Version="14.0.3" />
11+
1212
</ItemGroup>
1313
</Project>

samples/AdministrationApi/Program.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore;
7-
using Microsoft.AspNetCore.Hosting;
1+
using Microsoft.AspNetCore.Hosting;
82
using Microsoft.Extensions.Configuration;
93
using Microsoft.Extensions.Logging;
4+
using Ocelot.Administration;
105
using Ocelot.DependencyInjection;
116
using Ocelot.Middleware;
12-
using Ocelot.Administration;
7+
using System.IO;
138

149
namespace AdministrationApi
1510
{
16-
public class Program
11+
public class Program
1712
{
1813
public static void Main(string[] args)
1914
{

samples/OcelotKube/ApiGateway/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.AspNetCore.Builder;
22
using Microsoft.AspNetCore.Hosting;
33
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Hosting;
45
using Ocelot.DependencyInjection;
56
using Ocelot.Middleware;
67
using Ocelot.Provider.Kubernetes;
@@ -18,7 +19,7 @@ public void ConfigureServices(IServiceCollection services)
1819
}
1920

2021
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
21-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
22+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
2223
{
2324
if (env.IsDevelopment())
2425
{

samples/OcelotKube/DownstreamService/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.Mvc;
88
using Microsoft.Extensions.Configuration;
99
using Microsoft.Extensions.DependencyInjection;
10+
using Microsoft.Extensions.Hosting;
1011
using Microsoft.Extensions.Logging;
1112
using Microsoft.Extensions.Options;
1213

@@ -28,7 +29,7 @@ public void ConfigureServices(IServiceCollection services)
2829
}
2930

3031
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
31-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
32+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
3233
{
3334
if (env.IsDevelopment())
3435
{

0 commit comments

Comments
 (0)