Skip to content

Commit 3990835

Browse files
Add support for problem details (#20)
* Add support for problem details responses * Prevent redaction of api-supported-versions header * Bump minimum target frameworks and packages * Improve script for client generation
1 parent f2449d2 commit 3990835

37 files changed

+1646
-818
lines changed

build/Eryph.IdentityClient.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PowerShellVersion = '5.1'
4242
# PowerShellHostVersion = ''
4343

4444
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45-
DotNetFrameworkVersion = '4.6.1'
45+
DotNetFrameworkVersion = '4.6.2'
4646

4747
# Minimum version of the Identity language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
4848
ClrVersion = '4.0'

build/build-cmdlet.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ mkdir coreclr | Out-Null
3434
mkdir desktop | Out-Null
3535

3636
cp $rootDir\build\${cmdletName}* .
37-
cp $rootDir\src\${cmdletName}.Commands\bin\${Configuration}\netcoreapp3.1\* coreclr -Exclude $excludedFiles -Recurse
38-
cp $rootDir\src\${cmdletName}.Commands\bin\${Configuration}\net461\* desktop -Exclude $excludedFiles -Recurse
37+
cp $rootDir\src\${cmdletName}.Commands\bin\${Configuration}\net6.0\* coreclr -Exclude $excludedFiles -Recurse
38+
cp $rootDir\src\${cmdletName}.Commands\bin\${Configuration}\net462\* desktop -Exclude $excludedFiles -Recurse
3939

4040
$config = gc "${cmdletName}.psd1" -Raw
4141
$config = $config.Replace("ModuleVersion = '0.1'", "ModuleVersion = '${Env:GITVERSION_MajorMinorPatch}'");

gen/generate_local.ps1

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
1-
Push-Location $PSScriptRoot
2-
$settings = Get-Content -Raw -Path "config.json" | ConvertFrom-Json
3-
cd ..
4-
$location = Get-Location
1+
#Requires -Version 7.4
2+
<#
3+
.SYNOPSIS
4+
Generates the REST client locally
5+
.DESCRIPTION
6+
This script generates the REST client locally.
7+
#>
8+
[CmdletBinding()]
9+
param()
10+
11+
$PSNativeCommandUseErrorActionPreference = $true
12+
$ErrorActionPreference = 'Stop'
13+
14+
# Update the version in the csproj when changing this
15+
$autoRestCSharpVersion = "3.0.0-beta.20240527.2"
16+
17+
$settings = Get-Content -Raw -Path "$PSScriptRoot/config.json" | ConvertFrom-Json
518
$tag = $settings.tag
619
$spec = $settings.spec
720

8-
autorest ..\eryph-api-spec\specification\$spec --tag=$tag --csharp-src-folder=$location --v3 --csharp --verbose
21+
npm exec --package="[email protected]" -- `
22+
autorest `
23+
--version="3.10.2" `
24+
--use="@autorest/csharp@$autoRestCSharpVersion" `
25+
--use="@autorest/[email protected]" `
26+
"$PSScriptRoot/../../eryph-api-spec/specification/$spec" `
27+
--tag=$tag `
28+
--csharp-src-folder="$PSScriptRoot/.." `
29+
--v3 `
30+
--csharp `
31+
--skip-csproj=true `
32+
--generate-sample-project=false `
33+
--verbose

src/Eryph.IdentityClient.Commands/Eryph.IdentityClient.Commands.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net461</TargetFrameworks>
4+
<TargetFrameworks>net462;net6.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
6-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
6+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
7+
<LangVersion>12</LangVersion>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<PackageReference Include="Eryph.ClientRuntime.Powershell" Version="0.5.0" />
11+
<PackageReference Include="Eryph.ClientRuntime.Powershell" Version="0.7.0" />
1112
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
1213
<PrivateAssets>all</PrivateAssets>
1314
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/Eryph.IdentityClient.Commands/IdentityCmdLet.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ protected override void BeginProcessing()
3737
{
3838
IsDistributedTracingEnabled = true,
3939
IsLoggingEnabled = IsDebugEnabled,
40-
IsLoggingContentEnabled = IsDebugEnabled
40+
IsLoggingContentEnabled = IsDebugEnabled,
41+
LoggedHeaderNames = { "api-supported-versions" },
4142
}
4243
};
4344

src/Eryph.IdentityClient.Commands/NewEryphClientCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ protected override void ProcessRecord()
8989
{
9090
Id = result.Id,
9191
Name = result.Name,
92+
TenantId = result.TenantId,
9293
};
94+
9395
foreach (var allowedScope in result.AllowedScopes)
9496
{
9597
eryphClient.AllowedScopes.Add(allowedScope);
96-
9798
}
9899

99100
WriteObject(eryphClient);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"profiles": {
3+
"Eryph.IdentityClient.Commands": {
4+
"commandName": "Project"
5+
},
6+
"Run in Powershell": {
7+
"commandName": "Executable",
8+
"executablePath": "powershell.exe",
9+
"commandLineArgs": "-NoProfile -NoExit -Command \"Import-Module $(TargetPath)\""
10+
}
11+
}
12+
}

src/Eryph.IdentityClient.Commands/UnsafeAssemblyHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET461
1+
#if NET462
22

33
using System;
44
using System.IO;

src/Eryph.IdentityClient/Eryph.IdentityClient.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
</PropertyGroup>
88

99
<PropertyGroup>
10-
<LangVersion>11.0</LangVersion>
10+
<LangVersion>12</LangVersion>
1111
<IncludeGeneratorSharedCode>true</IncludeGeneratorSharedCode>
1212
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json</RestoreAdditionalProjectSources>
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Eryph.ClientRuntime.Authentication" Version="0.5.0" />
16+
<PackageReference Include="Eryph.ClientRuntime.Authentication" Version="0.7.0" />
1717
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
</PackageReference>
21-
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20231020.1" PrivateAssets="All" />
21+
<PackageReference Include="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20240527.2" PrivateAssets="All" />
2222
</ItemGroup>
2323
</Project>

src/Eryph.IdentityClient/Generated/ClientsClient.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal ClientsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin
4141
}
4242

4343
/// <summary> Creates a new client. </summary>
44-
/// <param name="body"> The Client to use. </param>
44+
/// <param name="body"> The <see cref="Client"/> to use. </param>
4545
/// <param name="cancellationToken"> The cancellation token to use. </param>
4646
/// <remarks> Creates a client. </remarks>
4747
public virtual async Task<Response<ClientWithSecret>> CreateAsync(Client body = null, CancellationToken cancellationToken = default)
@@ -60,7 +60,7 @@ public virtual async Task<Response<ClientWithSecret>> CreateAsync(Client body =
6060
}
6161

6262
/// <summary> Creates a new client. </summary>
63-
/// <param name="body"> The Client to use. </param>
63+
/// <param name="body"> The <see cref="Client"/> to use. </param>
6464
/// <param name="cancellationToken"> The cancellation token to use. </param>
6565
/// <remarks> Creates a client. </remarks>
6666
public virtual Response<ClientWithSecret> Create(Client body = null, CancellationToken cancellationToken = default)
@@ -79,7 +79,7 @@ public virtual Response<ClientWithSecret> Create(Client body = null, Cancellatio
7979
}
8080

8181
/// <summary> Deletes a client. </summary>
82-
/// <param name="id"> The String to use. </param>
82+
/// <param name="id"> The <see cref="string"/> to use. </param>
8383
/// <param name="cancellationToken"> The cancellation token to use. </param>
8484
public virtual async Task<Response> DeleteAsync(string id, CancellationToken cancellationToken = default)
8585
{
@@ -97,7 +97,7 @@ public virtual async Task<Response> DeleteAsync(string id, CancellationToken can
9797
}
9898

9999
/// <summary> Deletes a client. </summary>
100-
/// <param name="id"> The String to use. </param>
100+
/// <param name="id"> The <see cref="string"/> to use. </param>
101101
/// <param name="cancellationToken"> The cancellation token to use. </param>
102102
public virtual Response Delete(string id, CancellationToken cancellationToken = default)
103103
{
@@ -115,7 +115,7 @@ public virtual Response Delete(string id, CancellationToken cancellationToken =
115115
}
116116

117117
/// <summary> Get a client. </summary>
118-
/// <param name="id"> The String to use. </param>
118+
/// <param name="id"> The <see cref="string"/> to use. </param>
119119
/// <param name="cancellationToken"> The cancellation token to use. </param>
120120
public virtual async Task<Response<Client>> GetAsync(string id, CancellationToken cancellationToken = default)
121121
{
@@ -133,7 +133,7 @@ public virtual async Task<Response<Client>> GetAsync(string id, CancellationToke
133133
}
134134

135135
/// <summary> Get a client. </summary>
136-
/// <param name="id"> The String to use. </param>
136+
/// <param name="id"> The <see cref="string"/> to use. </param>
137137
/// <param name="cancellationToken"> The cancellation token to use. </param>
138138
public virtual Response<Client> Get(string id, CancellationToken cancellationToken = default)
139139
{
@@ -151,10 +151,10 @@ public virtual Response<Client> Get(string id, CancellationToken cancellationTok
151151
}
152152

153153
/// <summary> Updates a client. </summary>
154-
/// <param name="id"> The String to use. </param>
155-
/// <param name="body"> The Client to use. </param>
154+
/// <param name="id"> The <see cref="string"/> to use. </param>
155+
/// <param name="body"> The <see cref="Client"/> to use. </param>
156156
/// <param name="cancellationToken"> The cancellation token to use. </param>
157-
public virtual async Task<Response<Client>> UpdateAsync(string id, Client body = null, CancellationToken cancellationToken = default)
157+
public virtual async Task<Response<Client>> UpdateAsync(string id, Client body, CancellationToken cancellationToken = default)
158158
{
159159
using var scope = _clientDiagnostics.CreateScope("ClientsClient.Update");
160160
scope.Start();
@@ -170,10 +170,10 @@ public virtual async Task<Response<Client>> UpdateAsync(string id, Client body =
170170
}
171171

172172
/// <summary> Updates a client. </summary>
173-
/// <param name="id"> The String to use. </param>
174-
/// <param name="body"> The Client to use. </param>
173+
/// <param name="id"> The <see cref="string"/> to use. </param>
174+
/// <param name="body"> The <see cref="Client"/> to use. </param>
175175
/// <param name="cancellationToken"> The cancellation token to use. </param>
176-
public virtual Response<Client> Update(string id, Client body = null, CancellationToken cancellationToken = default)
176+
public virtual Response<Client> Update(string id, Client body, CancellationToken cancellationToken = default)
177177
{
178178
using var scope = _clientDiagnostics.CreateScope("ClientsClient.Update");
179179
scope.Start();
@@ -189,10 +189,10 @@ public virtual Response<Client> Update(string id, Client body = null, Cancellati
189189
}
190190

191191
/// <summary> Updates a client key. </summary>
192-
/// <param name="id"> The String to use. </param>
193-
/// <param name="body"> The NewClientKeyRequestBody to use. </param>
192+
/// <param name="id"> The <see cref="string"/> to use. </param>
193+
/// <param name="body"> The <see cref="NewClientKeyRequestBody"/> to use. </param>
194194
/// <param name="cancellationToken"> The cancellation token to use. </param>
195-
public virtual async Task<Response<ClientWithSecret>> NewKeyAsync(string id, NewClientKeyRequestBody body = null, CancellationToken cancellationToken = default)
195+
public virtual async Task<Response<ClientWithSecret>> NewKeyAsync(string id, NewClientKeyRequestBody body, CancellationToken cancellationToken = default)
196196
{
197197
using var scope = _clientDiagnostics.CreateScope("ClientsClient.NewKey");
198198
scope.Start();
@@ -208,10 +208,10 @@ public virtual async Task<Response<ClientWithSecret>> NewKeyAsync(string id, New
208208
}
209209

210210
/// <summary> Updates a client key. </summary>
211-
/// <param name="id"> The String to use. </param>
212-
/// <param name="body"> The NewClientKeyRequestBody to use. </param>
211+
/// <param name="id"> The <see cref="string"/> to use. </param>
212+
/// <param name="body"> The <see cref="NewClientKeyRequestBody"/> to use. </param>
213213
/// <param name="cancellationToken"> The cancellation token to use. </param>
214-
public virtual Response<ClientWithSecret> NewKey(string id, NewClientKeyRequestBody body = null, CancellationToken cancellationToken = default)
214+
public virtual Response<ClientWithSecret> NewKey(string id, NewClientKeyRequestBody body, CancellationToken cancellationToken = default)
215215
{
216216
using var scope = _clientDiagnostics.CreateScope("ClientsClient.NewKey");
217217
scope.Start();

0 commit comments

Comments
 (0)