{
    "version": 1,
    "defaults": {
        "configuration": {
            "accessKey": "myaccesskey",
            "region": "us-west-2",
            "environmentVariables": {
                "AWS_CSM_ENABLED": "true"
            },
            "sharedConfigFile": {}
        },
        "optionalEventFields": {
            "ApiCall": {},
            "ApiCallAttempt": {
                "DestinationIp": "ANY_STR",
                "AcquireConnectionLatency": "ANY_INT",
                "ConnectionReused": "ANY_INT",
                "ConnectLatency": "ANY_INT",
                "RequestLatency": "ANY_INT",
                "DnsLatency": "ANY_INT",
                "TcpLatency": "ANY_INT",
                "SslLatency": "ANY_INT"
            }
        }
    },
    "cases": [
        {
            "description": "Test a single client API call with no configuration provided",
            "configuration": {
                "accessKey": "myaccesskey",
                "region": "us-west-2",
                "environmentVariables": {},
                "sharedConfigFile": {}
            },
            "apiCalls": [
                {
                    "serviceId": "CSM Test",
                    "operationName": "TestOperation",
                    "params": {},
                    "attemptResponses": [
                        {
                            "httpStatus": 200,
                            "responseHeaders": {}
                        }
                    ]
                }
            ],
            "expectedMonitoringEvents": []
        },
        {
            "description": "Test a single client API call",
            "apiCalls": [
                {
                    "serviceId": "CSM Test",
                    "operationName": "TestOperation",
                    "params": {},
                    "attemptResponses": [
                        {
                            "httpStatus": 200,
                            "responseHeaders": {}
                        }
                    ]
                }
            ],
            "expectedMonitoringEvents": [
                {
                    "Type": "ApiCallAttempt",
                    "Service": "CSM Test",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Version": 1,
                    "Timestamp": "ANY_INT",
                    "AttemptLatency": "ANY_INT",
                    "Fqdn": "csmtest.us-west-2.amazonaws.com",
                    "UserAgent": "ANY_STR",
                    "Region": "us-west-2",
                    "AccessKey": "myaccesskey",
                    "HttpStatusCode": 200
                },
                {
                    "Type": "ApiCall",
                    "Service": "CSM Test",
                    "Region": "us-west-2",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Timestamp": "ANY_INT",
                    "Version": 1,
                    "AttemptCount": 1,
                    "Latency": "ANY_INT",
                    "MaxRetriesExceeded": 0
                }
            ]
        },
        {
            "description": "Test a single client API call with bad request",
            "apiCalls": [
                {
                    "serviceId": "CSM Test",
                    "operationName": "TestOperation",
                    "params": {},
                    "attemptResponses": [
                        {
                            "httpStatus": 400,
                            "responseHeaders": {},
                            "errorCode": "TestOperationException",
                            "errorMessage": "There was an error"
                        }
                    ]
                }
            ],
            "expectedMonitoringEvents": [
                {
                    "Type": "ApiCallAttempt",
                    "Service": "CSM Test",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Version": 1,
                    "Timestamp": "ANY_INT",
                    "AttemptLatency": "ANY_INT",
                    "Fqdn": "csmtest.us-west-2.amazonaws.com",
                    "UserAgent": "ANY_STR",
                    "Region": "us-west-2",
                    "AccessKey": "myaccesskey",
                    "HttpStatusCode": 400,
                    "AwsException": "TestOperationException",
                    "AwsExceptionMessage": "There was an error"
                },
                {
                    "Type": "ApiCall",
                    "Service": "CSM Test",
                    "Region": "us-west-2",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Timestamp": "ANY_INT",
                    "Version": 1,
                    "AttemptCount": 1,
                    "Latency": "ANY_INT",
                    "MaxRetriesExceeded": 0
                }
            ]
        },
        {
            "description": "Test a single client API call with retries",
            "apiCalls": [
                {
                    "serviceId": "CSM Test",
                    "operationName": "TestOperation",
                    "params": {},
                    "attemptResponses": [
                        {
                            "httpStatus": 503,
                            "responseHeaders": {},
                            "errorCode": "ServiceUnavailable",
                            "errorMessage": "Service is unavailable"
                        },
                        {
                            "httpStatus": 200,
                            "responseHeaders": {}
                        }
                    ]
                }
            ],
            "expectedMonitoringEvents": [
                {
                    "Type": "ApiCallAttempt",
                    "Service": "CSM Test",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Version": 1,
                    "Timestamp": "ANY_INT",
                    "AttemptLatency": "ANY_INT",
                    "Fqdn": "csmtest.us-west-2.amazonaws.com",
                    "UserAgent": "ANY_STR",
                    "Region": "us-west-2",
                    "AccessKey": "myaccesskey",
                    "HttpStatusCode": 503,
                    "AwsException": "ServiceUnavailable",
                    "AwsExceptionMessage": "Service is unavailable"
                },
                {
                    "Type": "ApiCallAttempt",
                    "Service": "CSM Test",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Version": 1,
                    "Timestamp": "ANY_INT",
                    "AttemptLatency": "ANY_INT",
                    "Fqdn": "csmtest.us-west-2.amazonaws.com",
                    "UserAgent": "ANY_STR",
                    "Region": "us-west-2",
                    "AccessKey": "myaccesskey",
                    "HttpStatusCode": 200
                },
                {
                    "Type": "ApiCall",
                    "Service": "CSM Test",
                    "Region": "us-west-2",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Timestamp": "ANY_INT",
                    "Version": 1,
                    "AttemptCount": 2,
                    "Latency": "ANY_INT",
                    "MaxRetriesExceeded": 0
                }
            ]
        },
        {
            "description": "Test a single client API call with non-retryable SDK exception",
            "apiCalls": [
                {
                    "serviceId": "CSM Test",
                    "operationName": "TestOperation",
                    "params": {},
                    "attemptResponses": [
                        {
                            "sdkException": {
                                "isRetryable": false,
                                "message": "Unexpected exception was thrown"
                            }
                        }
                    ]
                }
            ],
            "expectedMonitoringEvents": [
                {
                    "Type": "ApiCallAttempt",
                    "Service": "CSM Test",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Version": 1,
                    "Timestamp": "ANY_INT",
                    "AttemptLatency": "ANY_INT",
                    "Fqdn": "csmtest.us-west-2.amazonaws.com",
                    "UserAgent": "ANY_STR",
                    "Region": "us-west-2",
                    "AccessKey": "myaccesskey",
                    "SdkException": "ANY_STR",
                    "SdkExceptionMessage": "Unexpected exception was thrown"
                },
                {
                    "Type": "ApiCall",
                    "Service": "CSM Test",
                    "Region": "us-west-2",
                    "Api": "TestOperation",
                    "ClientId": "",
                    "Timestamp": "ANY_INT",
                    "Version": 1,
                    "AttemptCount": 1,
                    "Latency": "ANY_INT",
                    "MaxRetriesExceeded": 0
                }
            ]
        }
    ]
}
