Ejemplo n.º 1
0
        public static async Task GetJobAssignmentsAsync(ApiGatewayRequest request, McmaApiResponse response)
        {
            Logger.Debug(nameof(GetJobAssignmentsAsync));
            Logger.Debug(request.ToMcmaJson().ToString());

            var table = new DynamoDbTable(request.StageVariables["TableName"]);

            response.JsonBody = (await table.GetAllAsync <JobAssignment>()).ToMcmaJson();

            Logger.Debug(response.ToMcmaJson().ToString());
        }
        public static async Task GetBmEssencesAsync(ApiGatewayRequest request, McmaApiResponse response)
        {
            Logger.Debug(nameof(GetBmEssencesAsync));
            Logger.Debug(request.ToMcmaJson().ToString());

            var table = new DynamoDbTable(request.StageVariables["TableName"]);

            var essences = await table.GetAllAsync <BMEssence>();

            response.JsonBody = essences.ToMcmaJson();

            Logger.Debug(response.ToMcmaJson().ToString());
        }
Ejemplo n.º 3
0
        public static async Task DeleteJobAssignmentsAsync(ApiGatewayRequest request, McmaApiResponse response)
        {
            Logger.Debug(nameof(DeleteJobAssignmentsAsync));
            Logger.Debug(request.ToMcmaJson().ToString());

            var table = new DynamoDbTable(request.StageVariables["TableName"]);

            var jobAssignments = await table.GetAllAsync <JobAssignment>();

            foreach (var jobAssignment in jobAssignments)
            {
                await table.DeleteAsync <JobAssignment>(jobAssignment.Id);
            }

            Logger.Debug(response.ToMcmaJson().ToString());
        }
        public static async Task GetServicesAsync(ApiGatewayRequest request, McmaApiResponse response)
        {
            Logger.Debug(nameof(GetServicesAsync));
            Logger.Debug(request.ToMcmaJson().ToString());

            var table = new DynamoDbTable(request.StageVariables["TableName"]);

            var services = await table.GetAllAsync <Service>();

            if (request.QueryStringParameters.Any())
            {
                services.Filter(request.QueryStringParameters);
            }

            response.JsonBody = services.ToMcmaJson();

            Logger.Debug(response.ToMcmaJson().ToString());
        }
        public static async Task GetJobProfilesAsync(ApiGatewayRequest request, McmaApiResponse response)
        {
            Logger.Debug(nameof(GetJobProfilesAsync));
            Logger.Debug(request.ToMcmaJson().ToString());

            var table = new DynamoDbTable(request.StageVariables["TableName"]);

            var jobProfiles = await table.GetAllAsync <JobProfile>();

            if (request.QueryStringParameters.Any())
            {
                Logger.Debug(
                    "Applying job profile filter from query string: " + string.Join(", ", request.QueryStringParameters.Select(kvp => $"{kvp.Key}={kvp.Value}")));
                jobProfiles.Filter(request.QueryStringParameters);
            }

            response.JsonBody = jobProfiles.ToMcmaJson();

            Logger.Debug(response.ToMcmaJson().ToString());
        }