Net SDK for Windows
To integrate the SDK into a .NET project, during the installation process, you will need the "aapm-sdk.dll" and "aapm-shared.dll" files located within the "libs/net" directory. It's important to note that the .NET SDK does not include gRPC libraries. The .NET SDK was developed using version 5.0 of the .NET framework.
In this section, we will demonstrate how a developer can code with the AAPM SDK using the Visual Studio Code IDE. To create a sample project, start by opening a terminal both from the command line and within Visual Studio Code.
> dotnet new console
Using the command line interface, a new console project is created, and this project is then opened in Visual Studio Code. The mentioned DLLs can be copied from the libs/net directory to a newly created project folder named 'libs'.
To properly configure the .csproj file for the sample project, the following library references need to be added as shown below.
To install gRPC libraries provided via PackageReference in Visual Studio Code, we can utilize either an extension package manager (similar to NuGet) or execute the following command from the Visual Studio Code terminal window. This process enables seamless integration of gRPC libraries into the development environment, enhancing the capabilities and functionality of your projects.
> dotnet add package Grpc.Tools
The code style above can be observed to be similar to that of the Java SDK. Despite variations in the underlying infrastructure of all SDKs provided with the Kron AAPM SDK, their fundamental purpose remains consistent: to afford developers utilizing the SDK a comparable coding experience.
Within the .NET SDK, we utilize two essential objects: the PasswordManager and Response classes. In cases where direct connection to the Agent through the SDK is unavailable, accessing Kron PAM directly becomes imperative. To achieve this, the PasswordManager object must be decorated with the httpAddress method. Notably, when invoking PasswordManager.instance(), attention should be paid to passing the communication port (GRPC port) as an argument if connecting through the Agent. Failure to provide the GRPC port to this method will prompt the .NET SDK to retrieve it from the Windows Registry of the machine where it resides.
To run a sample application:
>dotnet build
>dotnet run Program
Rpc response success = [{"secret":{"password":"NnaF6X2m","username":"sapm1"}}]