This file contains hidden or 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 static void RegisterServices(IServiceCollection services, IConfiguration configuration) | |
| { | |
| ... | |
| services.AddScoped<IRequestHandler<CreateClienteCommand, CommandReturnDto>, CreateClienteCommandHandler>(); | |
| services.AddScoped<IRequestHandler<RemoveClienteCommand, CommandReturnDto>, RemoveClienteCommandHandler>(); | |
| services.AddScoped<IRequestHandler<UpdateClienteCommand, CommandReturnDto>, UpdateClienteCommandHandler>(); | |
| } |
This file contains hidden or 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 class CreateClienteCommandHandler : IRequestHandler<CreateClienteCommand, CommandReturnDto> | |
| { | |
| public CreateClienteCommandHandler(/*Repositories por injeção de dependência*/) | |
| { | |
| } | |
| public Task<CommandReturnDto> Handle(CreateClienteCommand request, CancellationToken cancellationToken) | |
| { | |
| // Insere nos bancos de dados e retorna o CommandReturnDto | |
| } |
This file contains hidden or 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 class CreateClienteCommand : IRequest<CommandReturnDto> | |
| { | |
| public string Nome { get; private set; } | |
| public string Cpf { get; private set; } | |
| public string Rua { get; private set; } | |
| public string Bairro { get; private set; } | |
| public string Cidade { get; private set; } | |
| public string Observacoes { get; private set; } | |
| public CreateClienteCommand(string nome, string cpf, string rua, string bairro, string cidade, string obs) |
This file contains hidden or 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
| { | |
| "ConnectionStrings": { | |
| "DefaultConnection": "Host=localhost;Port=5432;Database=postgres;User ID=postgres;Password=postgres", | |
| "MongoConnection": "mongodb://root:root@localhost:27017" | |
| } | |
| } |
This file contains hidden or 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' | |
| services: | |
| db-postgres: | |
| image: postgres | |
| container_name: db-postgres | |
| environment: | |
| POSTGRES_PASSWORD: "postgres" | |
| ports: | |
| - "5432:5432" |
This file contains hidden or 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
| name: Lambda deploy | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest |
This file contains hidden or 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
| link = aws_ext.link_from_object(bucketNameDest, archiveNameDest) | |
| return function_return(True, "Bucket successfully compressed!", link) |
This file contains hidden or 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
| aws_ext.delete_object_if_exists(bucketNameDest, archiveNameDest) | |
| binary = BytesIO() | |
| for page in objects.page_size(amount_objects).pages(): | |
| zip_file = aws_ext.get_object_summary(bucketNameDest, archiveNameDest) | |
| print("Upload +{} files to {}...".format(amount_objects, archiveNameDest)) |
This file contains hidden or 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
| print('Source Bucket:', bucketNameSource) | |
| print('Target archive:', bucketNameDest + '/' + archiveNameDest) | |
| objects = aws_ext.all_objects_from_bucket(bucketNameSource) | |
| count_objects = aws_ext.count_objects(objects) | |
| amount_objects = amountOfFilesToUpload | |
| if(amount_objects == 0): | |
| amount_objects = count_objects |
This file contains hidden or 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
| def lambda_handler(event, context): | |
| try: | |
| print('Started the Lambda function') | |
| bucketNameSource = event['bucket_name_source'] | |
| bucketNameDest = event['bucket_name_dest'] | |
| archiveNameDest = event['archive_name_dest'] | |
| archivePublicAccess = event['archive_public_access'] | |
| amountOfFilesToUpload = event['amount_of_files_to_upload'] |