class Aws::ClientSideMonitoring::RequestMetrics::ApiCallAttempt
def _truncate(document)
def _truncate(document) document.each do |key, value| limit = FIELD_MAX_LENGTH[key] if limit && value.to_s.length > limit document[key] = value.to_s.slice(0...limit) end end document end
def initialize(
def initialize( service, api, client_id, version, timestamp, fqdn, region, user_agent, access_key, session_token ) @service = service @api = api @client_id = client_id @version = version @timestamp = timestamp @fqdn = fqdn @region = region @user_agent = user_agent @access_key = access_key @session_token = session_token end
def to_json(*a)
def to_json(*a) json = { "Type" => "ApiCallAttempt", "Service" => @service, "Api" => @api, "ClientId" => @client_id, "Timestamp" => @timestamp, "Version" => @version, "Fqdn" => @fqdn, "Region" => @region, "UserAgent" => @user_agent, "AccessKey" => @access_key } # Optional Fields json["SessionToken"] = @session_token if @session_token json["HttpStatusCode"] = @http_status_code if @http_status_code json["AwsException"] = @aws_exception if @aws_exception json["AwsExceptionMessage"] = @aws_exception_msg if @aws_exception_msg json["XAmznRequestId"] = @x_amzn_request_id if @x_amzn_request_id json["XAmzRequestId"] = @x_amz_request_id if @x_amz_request_id json["XAmzId2"] = @x_amz_id_2 if @x_amz_id_2 json["AttemptLatency"] = @request_latency if @request_latency json["SdkException"] = @sdk_exception if @sdk_exception json["SdkExceptionMessage"] = @sdk_exception_msg if @sdk_exception_msg json = _truncate(json) json.to_json end