Skip to content

Commit

Permalink
feat(API): upgrade to Zitadel V1 API. (#48)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This breaks some of the
proto definitions. The services reside in
a new namespace (`Zitadel.` instead of `Caos.Zitadel.`)
and the messages and service methods changed.
For documentation over the api head over to
https://docs.zitadel.ch/docs/apis/apis.

Signed-off-by: Christoph Bühler <[email protected]>
  • Loading branch information
buehler authored Apr 16, 2021
1 parent 36ce8d9 commit 5ea82f2
Show file tree
Hide file tree
Showing 31 changed files with 9,309 additions and 6,027 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ nuget/
artifacts/
coverage/
.tmp/
.nuke/temp
.nuke/build.schema.json

# Build results
[Dd]ebug/
Expand Down
1 change: 0 additions & 1 deletion .nuke

This file was deleted.

4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "./build.schema.json",
"Solution": "Zitadel.sln"
}
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
:; exit $?

@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
powershell -ExecutionPolicy ByPass -NoProfile "%~dp0build.ps1" %*
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################

$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.tmp"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################

BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
Expand Down
12 changes: 6 additions & 6 deletions src/Zitadel.Api/Clients.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using System.Net.Http;
using Caos.Zitadel.Admin.Api.V1;
using Caos.Zitadel.Auth.Api.V1;
using Caos.Zitadel.Management.Api.V1;
using Grpc.Core;
using Grpc.Net.Client;
using Zitadel.Admin.V1;
using Zitadel.Auth.V1;
using Zitadel.Authentication;
using Zitadel.Management.V1;

namespace Zitadel.Api
{
Expand All @@ -18,23 +18,23 @@ public static class Clients
/// Create a service client for the auth service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Caos.Zitadel.Auth.Api.V1.AuthService.AuthServiceClient"/>.</returns>
/// <returns>The <see cref="Auth.V1.AuthService.AuthServiceClient"/>.</returns>
public static AuthService.AuthServiceClient AuthService(ClientOptions options) =>
GetClient<AuthService.AuthServiceClient>(options);

/// <summary>
/// Create a service client for the admin service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Caos.Zitadel.Admin.Api.V1.AdminService.AdminServiceClient"/>.</returns>
/// <returns>The <see cref="Admin.V1.AdminService.AdminServiceClient"/>.</returns>
public static AdminService.AdminServiceClient AdminService(ClientOptions options) =>
GetClient<AdminService.AdminServiceClient>(options);

/// <summary>
/// Create a service client for the management service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Caos.Zitadel.Management.Api.V1.ManagementService.ManagementServiceClient"/>.</returns>
/// <returns>The <see cref="Management.V1.ManagementService.ManagementServiceClient"/>.</returns>
public static ManagementService.ManagementServiceClient ManagementService(ClientOptions options) =>
GetClient<ManagementService.ManagementServiceClient>(options);

Expand Down
95 changes: 64 additions & 31 deletions src/Zitadel.Api/Zitadel.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\config\Common.targets" />

<Import Project="..\..\config\Common.targets"/>

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
Expand Down Expand Up @@ -32,54 +33,86 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Zitadel\Zitadel.csproj" />
<ProjectReference Include="..\Zitadel\Zitadel.csproj"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.15.8" />
<PackageReference Include="Grpc" Version="2.37.0" />
<PackageReference Include="Grpc.Core" Version="2.37.0" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.36.0" />
<PackageReference Include="Grpc.Net.Common" Version="2.36.0" />
<PackageReference Include="Grpc.Tools" Version="2.37.0" PrivateAssets="All" />
<PackageReference Include="Google.Protobuf" Version="3.15.8"/>
<PackageReference Include="Grpc" Version="2.37.0"/>
<PackageReference Include="Grpc.Core" Version="2.37.0"/>
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.36.0"/>
<PackageReference Include="Grpc.Net.Common" Version="2.36.0"/>
<PackageReference Include="Grpc.Tools" Version="2.37.0" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
<Protobuf Include="proto/admin.proto" GrpcServices="Client">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/master/pkg/grpc/admin/proto/admin.proto</SourceUrl>
</Protobuf>
<Protobuf Include="proto/auth.proto" GrpcServices="Client">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/master/pkg/grpc/auth/proto/auth.proto</SourceUrl>
</Protobuf>
<Protobuf Include="proto/management.proto" GrpcServices="Client">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/master/pkg/grpc/management/proto/management.proto</SourceUrl>
</Protobuf>
<Protobuf Include="proto/message.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/master/pkg/grpc/message/proto/message.proto</SourceUrl>
</Protobuf>
<Protobuf Include="authoption/options.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/master/internal/protoc/protoc-gen-authoption/authoption/options.proto</SourceUrl>
</Protobuf>
<Protobuf Include="google/api/annotations.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto</SourceUrl>
</Protobuf>
<Protobuf Include="google/api/http.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto</SourceUrl>
</Protobuf>
<Protobuf Include="protoc-gen-swagger/options/annotations.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v1/protoc-gen-swagger/options/annotations.proto</SourceUrl>
<Protobuf Include="protoc-gen-openapiv2/options/annotations.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-openapiv2/options/annotations.proto</SourceUrl>
</Protobuf>
<Protobuf Include="protoc-gen-swagger/options/openapiv2.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v1/protoc-gen-swagger/options/openapiv2.proto</SourceUrl>
<Protobuf Include="protoc-gen-openapiv2/options/openapiv2.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-openapiv2/options/openapiv2.proto</SourceUrl>
</Protobuf>
<Protobuf Include="validate/validate.proto" GrpcServices="Client" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/main/validate/validate.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/admin.proto" GrpcServices="Client">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/admin.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/app.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/app.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/auth.proto" GrpcServices="Client">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/auth.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/auth_n_key.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/auth_n_key.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/change.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/change.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/features.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/features.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/idp.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/idp.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/management.proto" GrpcServices="Client">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/management.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/member.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/member.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/message.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/message.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/object.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/object.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/options.proto" GrpcServices="None" Access="Internal">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/options.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/org.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/org.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/policy.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/policy.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/project.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/project.proto</SourceUrl>
</Protobuf>
<Protobuf Include="zitadel/user.proto" GrpcServices="None">
<SourceUrl>https://raw.githubusercontent.com/caos/zitadel/main/proto/zitadel/user.proto</SourceUrl>
</Protobuf>
</ItemGroup>

<Target Name="Update Protos" BeforeTargets="Build">
<Message Importance="high" Text="Refresh proto files in API" />
<Exec Command="dotnet dotnet-grpc refresh @(Protobuf, ' ')" WorkingDirectory="$(SolutionDir)\src\Zitadel.Api" />
<Message Importance="high" Text="Refresh proto files in API"/>
<Exec Command="dotnet dotnet-grpc refresh @(Protobuf, ' ')" WorkingDirectory="$(SolutionDir)\src\Zitadel.Api"/>
</Target>

</Project>
Loading

0 comments on commit 5ea82f2

Please sign in to comment.