This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming AWS CLI is installed and you have sufficient permissions | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$IAMUserName | |
) | |
# Fetch the access keys for the user | |
$keys = aws iam list-access-keys --user-name $IAMUserName | ConvertFrom-Json | |
# If 2 keys exist, delete the oldest one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
# JAEGER CHART IS BETAAAAA | |
services: | |
elasticsearch: | |
container_name: elasticsearch_database | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3 | |
networks: | |
- elastic-jaeger | |
ports: | |
- "127.0.0.1:9200:9200" #HTTP request listening port (API calls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddTransient<IPrinter, PrinterService>(); | |
services.AddTransient<ICalculator, CalculatorService>(); | |
services.AddControllers(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddScoped<IPrinter, PrinterService>(); | |
services.AddScoped<ICalculator, CalculatorService>(); | |
services.AddControllers(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in Services\Calculator\CalculatorService.cs | |
public class CalculatorService : ICalculator | |
{ | |
// this was added | |
private readonly IPrinter _printer; | |
public CalculatorService( IPrinter printer) | |
{ | |
this._printer = printer; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this in Services\ConsolePrinter\IPrinter | |
public interface IPrinter | |
{ | |
void PrintToConsole(int Result); | |
// this was added | |
void PingPong(); | |
} | |
// this in Services\ConsolePrinter\PrinterService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in Startup.cs | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddSingleton<IPrinter, PrinterService>(); | |
services.AddSingleton<ICalculator, CalculatorService>(); | |
services.AddControllers(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiController] | |
[Route("calculator")] | |
public class CalculatorController : Controller | |
{ | |
// interfaces and not implementations | |
private readonly IPrinter _printer; | |
private readonly ICalculator _calculator; | |
// "initialized" interfaces passed as controller's constructor parameters | |
public CalculatorController(IPrinter printer, ICalculator calculator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy this in Services\Calculator\CalculatorService.cs | |
public class CalculatorService : ICalculator | |
{ | |
public CalculatorService() | |
{ | |
} | |
public int Substract(int a, int b) | |
{ | |
return a - b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy this in Services\Calculator\ICalculator.cs | |
public interface ICalculator | |
{ | |
int Sum(int a, int b); | |
int Substract(int a, int b); | |
} | |
// copy this in Services\Printer\IPrinter.cs | |
public interface IPrinter |
NewerOlder