Skip to content

Commit cf2bade

Browse files
authored
docs: Fix docs (#20)
1 parent 2276f04 commit cf2bade

File tree

7 files changed

+36
-21
lines changed

7 files changed

+36
-21
lines changed

docs/DevEnvironmentSetup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ From the repository root directory:
5656
```
5757
* Run command to compile policies in the example project.
5858
```shell
59-
dotnet policy-compiler --s .\source\ --o .\target\ --format true
59+
dotnet azure-apim-policy-compiler --s .\source\ --o .\target\ --format true
6060
```

docs/IntegratePolicySolution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Because the Bicep file for deployment is in the `.\infrastructure\` folder, the
7777
`.\infrastructure\` as well. This will allow easy referencing of the policy documents in the bicep file.
7878

7979
```shell
80-
dotnet policy-compiler --s .\src\ --o .\infrastructure\
80+
dotnet azure-apim-policy-compiler --s .\src\ --o .\infrastructure\
8181
```
8282

8383
The command will produce the policy documents and the folder structure will look like this:
@@ -209,7 +209,7 @@ jobs:
209209
run: dotnet tool restore
210210
211211
- name: Compile policy documents
212-
run: dotnet policy-compiler --s .\src\ --o .\infrastructure\
212+
run: dotnet azure-apim-policy-compiler --s .\src\ --o .\infrastructure\
213213
214214
- name: Azure Login
215215
uses: azure/login@v2
@@ -277,7 +277,7 @@ steps:
277277
- script: dotnet tool restore
278278
displayName: 'Restore tools'
279279
280-
- script: dotnet policy-compiler --s .\src\ --o .\infrastructure\
280+
- script: dotnet azure-apim-policy-compiler --s .\src\ --o .\infrastructure\
281281
displayName: 'Compile policy documents'
282282
283283
- task: AzureCLI@2

docs/IntegratePolicySolutionWithApiOps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The compiler should target `artifacts` folder with APIOps data.
9595
An example of the command to run the compiler is below.
9696

9797
```shell
98-
dotnet policy-compiler --s .\policies\src\ --o .\artifacts\
98+
dotnet azure-apim-policy-compiler --s .\policies\src\ --o .\artifacts\
9999
```
100100

101101
After the command is executed the `artifacts` folder should contain all the policy files which can be easily published

docs/QuickStart.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,40 @@ We will cover the following topics:
1212

1313
## Set up project for authoring policies
1414

15-
* Check that you have latest [.NET SDK 8 sdk](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) version installed.
16-
* Open terminal and create a new solution by executing
15+
1. Check that you have latest [.NET SDK 8 sdk](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) version installed.
16+
2. Open terminal and create a new solution by executing
1717
```shell
1818
dotnet new sln --output PolicySolution
1919
cd PolicySolution
2020
```
21-
* Create a new class library project by executing
21+
3. Create a new class library project by executing
2222
```shell
2323
dotnet new classlib --output Contoso.Apis.Policies
24-
cd Contoso.Apis.Policies
24+
dotnet sln add ./Contoso.Apis.Policies
2525
```
26-
* Add Azure API Management policy toolkit library by running
26+
4. :exclamation: Azure API Management Policy toolkit is not yet published to NuGet.
27+
Because of that, we need to create a local nuget repository for the packages and put the libraries there.
28+
1. Create a local nuget repository for the packages by executing
29+
```shell
30+
mkdir packages
31+
```
32+
2. Download the Azure API Management policy toolkit libraries from GitHub release and put them in the `packages` folder.
33+
3. Create a file named `nuget.config` in the solution folder with the content:
34+
```xml
35+
<configuration>
36+
<packageSources>
37+
<!-- local feed for the project -->
38+
<add key="local" value="./packages" />
39+
</packageSources>
40+
</configuration>
41+
```
42+
5. Add Azure API Management policy toolkit library by running
2743
```shell
44+
cd ./Contoso.Apis.Policies
2845
dotnet add package Azure.ApiManagement.PolicyToolkit.Authoring
2946
```
3047

31-
| :exclamation: Azure API Management Policy toolkit is not yet published to NuGet. For now, please follow the repository setup guide to obtain packages mentioned in the document. |
32-
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
33-
34-
* Open the solution in your IDE of choice. We
48+
6. Open the solution in your IDE of choice. We
3549
tested [Visual Studio ](https://visualstudio.microsoft.com), [Raider](https://www.jetbrains.com/rider/), [Visual Studio Code](https://code.visualstudio.com/)
3650
with [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit),
3751
but any IDE with C# support should work.
@@ -253,6 +267,7 @@ the following commands.
253267

254268
```shell
255269
dotnet new mstest --output Contoso.Apis.Policies.Tests
270+
dotnet sln add ./Contoso.Apis.Policies.Tests
256271
cd Contoso.Apis.Policies.Tests
257272
dotnet add package Azure.ApiManagement.PolicyToolkit.Testing
258273
dotnet add reference ..\Contoso.Apis.Policies
@@ -279,10 +294,10 @@ public class ApiOperationPolicyTest
279294
{
280295
var context = new MockExpressionContext();
281296
282-
context.MockRequest.IpAddress = "10.0.0.12";
297+
context.Request.IpAddress = "10.0.0.12";
283298
Assert.IsTrue(ApiOperationPolicy.IsCompanyIP(context));
284299
285-
context.MockRequest.IpAddress = "11.0.0.1";
300+
context.Request.IpAddress = "11.0.0.1";
286301
Assert.IsFalse(ApiOperationPolicy.IsCompanyIP(context));
287302
}
288303
}

docs/SolutionStructureRecommendation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ documents as a flat structure. For example, the following command will compile t
4646
the `target` folder:
4747

4848
```shell
49-
dotnet policy-compiler --s .\src\ --o .\target\
49+
dotnet azure-apim-policy-compiler --s .\src\ --o .\target\
5050
```
5151

5252
Target folder after the compilation will look like this:
@@ -143,7 +143,7 @@ documents in the same structure as is present under `src` folder. For example, t
143143
policies and place them in the `target` folder:
144144

145145
```shell
146-
dotnet policy-compiler --s .\src\ --o .\target\
146+
dotnet azure-apim-policy-compiler --s .\src\ --o .\target\
147147
```
148148

149149
```

example/.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"version": 1,
33
"isRoot": true,
44
"tools": {
5-
"Azure.ApiManagement.policytoolkit.compiler": {
5+
"Azure.ApiManagement.PolicyToolkit.Compiling": {
66
"version": "0.0.1",
77
"commands": [
8-
"policy-compiler"
8+
"azure-apim-policy-compiler"
99
]
1010
}
1111
}

example/ci-pipeline.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dotnet build || exit -1
22
dotnet test || exit -2
3-
dotnet policy-compiler --s .\source\ --o .\target\ --format true || exit -3
3+
dotnet azure-apim-policy-compiler --s .\source\ --o .\target\ --format true || exit -3
44
az deployment group create --resource-group YOUR_RESOURCE_GROUP --template-file .\deployment.bicep --parameters servicename=YOUR_SERVICE_NAME --name deploy-1 || exit -4

0 commit comments

Comments
 (0)