JCKalt / General-Work

Modeling database
0 stars 0 forks source link

ES2 API Generation #213

Open JCKalt opened 4 months ago

JCKalt commented 4 months ago
JCKalt commented 4 months ago
First undo causing error:

% bin/undo_last_create_api_with_prompts.sh 
Press Enter to Undo script #18 -- undo_step_18_create_route53_record_test.sh : 

An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [Tried to delete resource record set [name='pges2api.plasmaguard.com.', type='CNAME'] but the values provided do not match the current values]
Press Enter to Undo script #17 -- undo_step_17_create_api_mapping_test.sh : 

% cat abin/undo_step_17_create_api_mapping_test.sh
#!/bin/bash

# File: undo_step_17_create_api_mapping_test.sh

source abin/api_id.txt
mapping_id=$(aws apigatewayv2 get-api-mappings --domain-name pges2api.plasmaguard.com --query "Items[?ApiId=='$api_id'].ApiMappingId | [0]" --output text --region us-east-2)
if [ -n "$mapping_id" ]; then
  aws apigatewayv2 delete-api-mapping --api-mapping-id $mapping_id --domain-name pges2api.plasmaguard.com --region us-east-2
else
  echo "No API mapping found for the test stage."
fi
JCKalt commented 4 months ago
Press Enter to Undo script #14 -- undo_step_14_deploy_http_api_test.sh : 

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument --deployment-id: expected one argument

 % cat abin/undo_step_14_deploy_http_api_test.sh
#!/bin/bash

# File: undo_step_14_deploy_http_api_test.sh

source abin/api_id.txt
source abin/deployment_id_test.txt
aws apigatewayv2 delete-deployment --api-id $api_id --deployment-id $deployment_id --region us-east-2
aws apigatewayv2 delete-stage --api-id $api_id --stage-name test --region us-east-2
JCKalt commented 4 months ago
Press Enter to Undo script #7 -- undo_step_7_create_lambda_device.sh : 

An error occurred (ResourceNotFoundException) when calling the DeleteLogGroup operation: The specified log group does not exist.

 % cat abin/undo_step_7_create_lambda_device.sh
#!/bin/bash

# File: undo_step_7_create_lambda_device.sh

aws lambda delete-function --function-name http-es2-handler-device --region us-east-2
aws logs delete-log-group --log-group-name /aws/lambda/http-es2-handler-device --region us-east-2
JCKalt commented 3 months ago

setup http api cloudwatch logging

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging.html

aws logs create-log-group --log-group-name my-log-group aws apigatewayv2 update-stage --api-id abcdef \ --stage-name '$default' \ --access-log-settings '{"DestinationArn": "arn:aws:logs:region:account-id:log-group:log-group-name", "Format": "$context.identity.sourceIp - - [$context.requestTime] \"$context.httpMethod $context.routeKey $context.protocol\" $context.status $context.responseLength $context.requestId"}'

JCKalt commented 3 months ago

Running bin/run-create-api-with-prompts.sh --force just ran without stops.

Need to try undo --force and list stops.

JCKalt commented 3 months ago

custom_domain_name was named wrong in shared_variables.sh when

following change was made for running bin/reset.sh

python src/generate-scripts.py --test-mode --api-prefix ${API_PREFIX} --subdomain ${API_PREFIX} --hello

python src/generate-scripts.py --test-mode --api-prefix ${API_PREFIX} --hello --stages dev

name duplicated plasmaguard.com in string.

JCKalt commented 2 months ago

OAS response needs to be updated for GET /login/refresh when refresh token fails:

Error: Request failed with HTTP status 401
Response Body:
{
  "error": "Authentication failed",
  "details": "Refresh Token has expired"
}
JCKalt commented 1 month ago

New Endpoints (using use/gen plan feature)

Implement:
    PUT /devices/auto (use gen plan over add endpoint)
    GET /iotdevicetxns/metrics/{device-id} - pass in real
    GET /iotdevicetxns/metrics
    GET /devices-view
        insert iot-metrics from the GET  /iotdevicetxns/metrics/{device-id} 
    GET  Guide PDF