text:
# Automatically generated using Clang.jl

const JPEG_LIB_VERSION = 62
const LIBJPEG_TURBO_VERSION = ".0."
const LIBJPEG_TURBO_VERSION_NUMBER = 2000001
const C_ARITH_CODING_SUPPORTED = 1
const D_ARITH_CODING_SUPPORTED = 1
const MEM_SRCDST_SUPPORTED = 1
const WITH_SIMD = 1
const BITS_IN_JSAMPLE = 8
const HAVE_LOCALE_H = 1
const HAVE_STDDEF_H = 1
const HAVE_STDLIB_H = 1
const NEED_SYS_TYPES_H = 1
const HAVE_UNSIGNED_CHAR = 1
const HAVE_UNSIGNED_SHORT = 1
const MAX_COMPONENTS = 10

# Skipping MacroDefinition: GETJSAMPLE ( value ) ( ( int ) ( value ) & 0xFF )

const MAXJSAMPLE = 255
const CENTERJSAMPLE = 128

# Skipping MacroDefinition: GETJOCTET ( value ) ( ( value ) & 0xFF )

const JPEG_MAX_DIMENSION = Int32(65500)

# Skipping MacroDefinition: METHODDEF ( type ) static type
# Skipping MacroDefinition: LOCAL ( type ) static type
# Skipping MacroDefinition: GLOBAL ( type ) type
# Skipping MacroDefinition: EXTERN ( type ) extern type
# Skipping MacroDefinition: JMETHOD ( type , methodname , arglist ) type ( * methodname ) arglist

const FALSE = 0
const TRUE = 1
const JSAMPLE = UInt8
const JCOEF = Int16
const JOCTET = UInt8
const UINT8 = Int16
const UINT16 = UInt32
const INT16 = Int16
const INT32 = Clong
const JDIMENSION = UInt32
const boolean = Cint

# Skipping MacroDefinition: JMESSAGE ( code , string ) code ,
# Skipping MacroDefinition: ERREXIT ( cinfo , code ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( * ( cinfo ) -> err -> error_exit ) ( ( j_common_ptr ) ( cinfo ) ) )
# Skipping MacroDefinition: ERREXIT1 ( cinfo , code , p1 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( * ( cinfo ) -> err -> error_exit ) ( ( j_common_ptr ) ( cinfo ) ) )
# Skipping MacroDefinition: ERREXIT2 ( cinfo , code , p1 , p2 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( cinfo ) -> err -> msg_parm . i [ 1 ] = ( p2 ) , ( * ( cinfo ) -> err -> error_exit ) ( ( j_common_ptr ) ( cinfo ) ) )
# Skipping MacroDefinition: ERREXIT3 ( cinfo , code , p1 , p2 , p3 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( cinfo ) -> err -> msg_parm . i [ 1 ] = ( p2 ) , ( cinfo ) -> err -> msg_parm . i [ 2 ] = ( p3 ) , ( * ( cinfo ) -> err -> error_exit ) ( ( j_common_ptr ) ( cinfo ) ) )
# Skipping MacroDefinition: ERREXIT4 ( cinfo , code , p1 , p2 , p3 , p4 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( cinfo ) -> err -> msg_parm . i [ 1 ] = ( p2 ) , ( cinfo ) -> err -> msg_parm . i [ 2 ] = ( p3 ) , ( cinfo ) -> err -> msg_parm . i [ 3 ] = ( p4 ) , ( * ( cinfo ) -> err -> error_exit ) ( ( j_common_ptr ) ( cinfo ) ) )
# Skipping MacroDefinition: ERREXITS ( cinfo , code , str ) ( ( cinfo ) -> err -> msg_code = ( code ) , strncpy ( ( cinfo ) -> err -> msg_parm . s , ( str ) , JMSG_STR_PARM_MAX ) , ( * ( cinfo ) -> err -> error_exit ) ( ( j_common_ptr ) ( cinfo ) ) )
# Skipping MacroDefinition: MAKESTMT ( stuff ) do { stuff } while ( 0 )
# Skipping MacroDefinition: WARNMS ( cinfo , code ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , - 1 ) )
# Skipping MacroDefinition: WARNMS1 ( cinfo , code , p1 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , - 1 ) )
# Skipping MacroDefinition: WARNMS2 ( cinfo , code , p1 , p2 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( cinfo ) -> err -> msg_parm . i [ 1 ] = ( p2 ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , - 1 ) )
# Skipping MacroDefinition: TRACEMS ( cinfo , lvl , code ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) )
# Skipping MacroDefinition: TRACEMS1 ( cinfo , lvl , code , p1 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) )
# Skipping MacroDefinition: TRACEMS2 ( cinfo , lvl , code , p1 , p2 ) ( ( cinfo ) -> err -> msg_code = ( code ) , ( cinfo ) -> err -> msg_parm . i [ 0 ] = ( p1 ) , ( cinfo ) -> err -> msg_parm . i [ 1 ] = ( p2 ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) )
# Skipping MacroDefinition: TRACEMS3 ( cinfo , lvl , code , p1 , p2 , p3 ) MAKESTMT ( int * _mp = ( cinfo ) -> err -> msg_parm . i ; _mp [ 0 ] = ( p1 ) ; _mp [ 1 ] = ( p2 ) ; _mp [ 2 ] = ( p3 ) ; ( cinfo ) -> err -> msg_code = ( code ) ; ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) ; )
# Skipping MacroDefinition: TRACEMS4 ( cinfo , lvl , code , p1 , p2 , p3 , p4 ) MAKESTMT ( int * _mp = ( cinfo ) -> err -> msg_parm . i ; _mp [ 0 ] = ( p1 ) ; _mp [ 1 ] = ( p2 ) ; _mp [ 2 ] = ( p3 ) ; _mp [ 3 ] = ( p4 ) ; ( cinfo ) -> err -> msg_code = ( code ) ; ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) ; )
# Skipping MacroDefinition: TRACEMS5 ( cinfo , lvl , code , p1 , p2 , p3 , p4 , p5 ) MAKESTMT ( int * _mp = ( cinfo ) -> err -> msg_parm . i ; _mp [ 0 ] = ( p1 ) ; _mp [ 1 ] = ( p2 ) ; _mp [ 2 ] = ( p3 ) ; _mp [ 3 ] = ( p4 ) ; _mp [ 4 ] = ( p5 ) ; ( cinfo ) -> err -> msg_code = ( code ) ; ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) ; )
# Skipping MacroDefinition: TRACEMS8 ( cinfo , lvl , code , p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 ) MAKESTMT ( int * _mp = ( cinfo ) -> err -> msg_parm . i ; _mp [ 0 ] = ( p1 ) ; _mp [ 1 ] = ( p2 ) ; _mp [ 2 ] = ( p3 ) ; _mp [ 3 ] = ( p4 ) ; _mp [ 4 ] = ( p5 ) ; _mp [ 5 ] = ( p6 ) ; _mp [ 6 ] = ( p7 ) ; _mp [ 7 ] = ( p8 ) ; ( cinfo ) -> err -> msg_code = ( code ) ; ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) ; )
# Skipping MacroDefinition: TRACEMSS ( cinfo , lvl , code , str ) ( ( cinfo ) -> err -> msg_code = ( code ) , strncpy ( ( cinfo ) -> err -> msg_parm . s , ( str ) , JMSG_STR_PARM_MAX ) , ( * ( cinfo ) -> err -> emit_message ) ( ( j_common_ptr ) ( cinfo ) , ( lvl ) ) )

@cenum J_MESSAGE_CODE::UInt32 begin
    JMSG_NOMESSAGE = 0
    JERR_ARITH_NOTIMPL = 1
    JERR_BAD_ALIGN_TYPE = 2
    JERR_BAD_ALLOC_CHUNK = 3
    JERR_BAD_BUFFER_MODE = 4
    JERR_BAD_COMPONENT_ID = 5
    JERR_BAD_DCT_COEF = 6
    JERR_BAD_DCTSIZE = 7
    JERR_BAD_HUFF_TABLE = 8
    JERR_BAD_IN_COLORSPACE = 9
    JERR_BAD_J_COLORSPACE = 10
    JERR_BAD_LENGTH = 11
    JERR_BAD_LIB_VERSION = 12
    JERR_BAD_MCU_SIZE = 13
    JERR_BAD_POOL_ID = 14
    JERR_BAD_PRECISION = 15
    JERR_BAD_PROGRESSION = 16
    JERR_BAD_PROG_SCRIPT = 17
    JERR_BAD_SAMPLING = 18
    JERR_BAD_SCAN_SCRIPT = 19
    JERR_BAD_STATE = 20
    JERR_BAD_STRUCT_SIZE = 21
    JERR_BAD_VIRTUAL_ACCESS = 22
    JERR_BUFFER_SIZE = 23
    JERR_CANT_SUSPEND = 24
    JERR_CCIR601_NOTIMPL = 25
    JERR_COMPONENT_COUNT = 26
    JERR_CONVERSION_NOTIMPL = 27
    JERR_DAC_INDEX = 28
    JERR_DAC_VALUE = 29
    JERR_DHT_INDEX = 30
    JERR_DQT_INDEX = 31
    JERR_EMPTY_IMAGE = 32
    JERR_EMS_READ = 33
    JERR_EMS_WRITE = 34
    JERR_EOI_EXPECTED = 35
    JERR_FILE_READ = 36
    JERR_FILE_WRITE = 37
    JERR_FRACT_SAMPLE_NOTIMPL = 38
    JERR_HUFF_CLEN_OVERFLOW = 39
    JERR_HUFF_MISSING_CODE = 40
    JERR_IMAGE_TOO_BIG = 41
    JERR_INPUT_EMPTY = 42
    JERR_INPUT_EOF = 43
    JERR_MISMATCHED_QUANT_TABLE = 44
    JERR_MISSING_DATA = 45
    JERR_MODE_CHANGE = 46
    JERR_NOTIMPL = 47
    JERR_NOT_COMPILED = 48
    JERR_NO_BACKING_STORE = 49
    JERR_NO_HUFF_TABLE = 50
    JERR_NO_IMAGE = 51
    JERR_NO_QUANT_TABLE = 52
    JERR_NO_SOI = 53
    JERR_OUT_OF_MEMORY = 54
    JERR_QUANT_COMPONENTS = 55
    JERR_QUANT_FEW_COLORS = 56
    JERR_QUANT_MANY_COLORS = 57
    JERR_SOF_DUPLICATE = 58
    JERR_SOF_NO_SOS = 59
    JERR_SOF_UNSUPPORTED = 60
    JERR_SOI_DUPLICATE = 61
    JERR_SOS_NO_SOF = 62
    JERR_TFILE_CREATE = 63
    JERR_TFILE_READ = 64
    JERR_TFILE_SEEK = 65
    JERR_TFILE_WRITE = 66
    JERR_TOO_LITTLE_DATA = 67
    JERR_UNKNOWN_MARKER = 68
    JERR_VIRTUAL_BUG = 69
    JERR_WIDTH_OVERFLOW = 70
    JERR_XMS_READ = 71
    JERR_XMS_WRITE = 72
    JMSG_COPYRIGHT = 73
    JMSG_VERSION = 74
    JTRC_16BIT_TABLES = 75
    JTRC_ADOBE = 76
    JTRC_APP0 = 77
    JTRC_APP14 = 78
    JTRC_DAC = 79
    JTRC_DHT = 80
    JTRC_DQT = 81
    JTRC_DRI = 82
    JTRC_EMS_CLOSE = 83
    JTRC_EMS_OPEN = 84
    JTRC_EOI = 85
    JTRC_HUFFBITS = 86
    JTRC_JFIF = 87
    JTRC_JFIF_BADTHUMBNAILSIZE = 88
    JTRC_JFIF_EXTENSION = 89
    JTRC_JFIF_THUMBNAIL = 90
    JTRC_MISC_MARKER = 91
    JTRC_PARMLESS_MARKER = 92
    JTRC_QUANTVALS = 93
    JTRC_QUANT_3_NCOLORS = 94
    JTRC_QUANT_NCOLORS = 95
    JTRC_QUANT_SELECTED = 96
    JTRC_RECOVERY_ACTION = 97
    JTRC_RST = 98
    JTRC_SMOOTH_NOTIMPL = 99
    JTRC_SOF = 100
    JTRC_SOF_COMPONENT = 101
    JTRC_SOI = 102
    JTRC_SOS = 103
    JTRC_SOS_COMPONENT = 104
    JTRC_SOS_PARAMS = 105
    JTRC_TFILE_CLOSE = 106
    JTRC_TFILE_OPEN = 107
    JTRC_THUMB_JPEG = 108
    JTRC_THUMB_PALETTE = 109
    JTRC_THUMB_RGB = 110
    JTRC_UNKNOWN_IDS = 111
    JTRC_XMS_CLOSE = 112
    JTRC_XMS_OPEN = 113
    JWRN_ADOBE_XFORM = 114
    JWRN_BOGUS_PROGRESSION = 115
    JWRN_EXTRANEOUS_DATA = 116
    JWRN_HIT_MARKER = 117
    JWRN_HUFF_BAD_CODE = 118
    JWRN_JFIF_MAJOR = 119
    JWRN_JPEG_EOF = 120
    JWRN_MUST_RESYNC = 121
    JWRN_NOT_SEQUENTIAL = 122
    JWRN_TOO_MUCH_DATA = 123
    JERR_BAD_CROP_SPEC = 124
    JWRN_BOGUS_ICC = 125
    JMSG_LASTMSGCODE = 126
end

const DCTSIZE = 8
const DCTSIZE2 = 64
const NUM_QUANT_TBLS = 4
const NUM_HUFF_TBLS = 4
const NUM_ARITH_TBLS = 16
const MAX_COMPS_IN_SCAN = 4
const MAX_SAMP_FACTOR = 4
const C_MAX_BLOCKS_IN_MCU = 10
const D_MAX_BLOCKS_IN_MCU = 10
const JCS_EXTENSIONS = 1
const JCS_ALPHA_EXTENSIONS = 1

@cenum J_DCT_METHOD::UInt32 begin
    JDCT_ISLOW = 0
    JDCT_IFAST = 1
    JDCT_FLOAT = 2
end

const JDCT_DEFAULT = JDCT_ISLOW
const JDCT_FASTEST = JDCT_IFAST

# Skipping MacroDefinition: jpeg_common_fields struct jpeg_error_mgr * err ; /* Error handler module */ struct jpeg_memory_mgr * mem ; /* Memory manager module */ struct jpeg_progress_mgr * progress ; /* Progress monitor, or NULL if none */ void * client_data ; /* Available for use by application */ boolean is_decompressor ; /* So common code can tell which is which */ int global_state

const JMSG_LENGTH_MAX = 200
const JMSG_STR_PARM_MAX = 80
const JPOOL_PERMANENT = 0
const JPOOL_IMAGE = 1
const JPOOL_NUMPOOLS = 2

# Skipping MacroDefinition: JPP ( arglist ) arglist
# Skipping MacroDefinition: jpeg_create_compress ( cinfo ) jpeg_CreateCompress ( ( cinfo ) , JPEG_LIB_VERSION , ( size_t ) sizeof ( struct jpeg_compress_struct ) )
# Skipping MacroDefinition: jpeg_create_decompress ( cinfo ) jpeg_CreateDecompress ( ( cinfo ) , JPEG_LIB_VERSION , ( size_t ) sizeof ( struct jpeg_decompress_struct ) )

const JPEG_SUSPENDED = 0
const JPEG_HEADER_OK = 1
const JPEG_HEADER_TABLES_ONLY = 2
const JPEG_REACHED_SOS = 1
const JPEG_REACHED_EOI = 2
const JPEG_ROW_COMPLETED = 3
const JPEG_SCAN_COMPLETED = 4
const JPEG_RST0 = 0xd0
const JPEG_EOI = 0xd9
const JPEG_APP0 = 0xe0
const JPEG_COM = 0xfe
const JSAMPROW = Ptr{JSAMPLE}
const JSAMPARRAY = Ptr{JSAMPROW}
const JSAMPIMAGE = Ptr{JSAMPARRAY}
const JBLOCK = NTuple{64, JCOEF}
const JBLOCKROW = Ptr{JBLOCK}
const JBLOCKARRAY = Ptr{JBLOCKROW}
const JBLOCKIMAGE = Ptr{JBLOCKARRAY}
const JCOEFPTR = Ptr{JCOEF}

struct JQUANT_TBL
    quantval::NTuple{64, UINT16}
    sent_table::boolean
end

struct JHUFF_TBL
    bits::NTuple{17, UINT8}
    huffval::NTuple{256, UINT8}
    sent_table::boolean
end

struct jpeg_component_info
    component_id::Cint
    component_index::Cint
    h_samp_factor::Cint
    v_samp_factor::Cint
    quant_tbl_no::Cint
    dc_tbl_no::Cint
    ac_tbl_no::Cint
    width_in_blocks::JDIMENSION
    height_in_blocks::JDIMENSION
    DCT_scaled_size::Cint
    downsampled_width::JDIMENSION
    downsampled_height::JDIMENSION
    component_needed::boolean
    MCU_width::Cint
    MCU_height::Cint
    MCU_blocks::Cint
    MCU_sample_width::Cint
    last_col_width::Cint
    last_row_height::Cint
    quant_table::Ptr{JQUANT_TBL}
    dct_table::Ptr{Cvoid}
end

struct jpeg_scan_info
    comps_in_scan::Cint
    component_index::NTuple{4, Cint}
    Ss::Cint
    Se::Cint
    Ah::Cint
    Al::Cint
end

#const jpeg_saved_marker_ptr = Ptr{jpeg_marker_struct}

struct jpeg_marker_struct
    #next::jpeg_saved_marker_ptr
    next::Ptr{Cvoid}
    marker::UINT8
    original_length::UInt32
    data_length::UInt32
    data::Ptr{JOCTET}
end

const jpeg_saved_marker_ptr = Ptr{jpeg_marker_struct}

@cenum J_COLOR_SPACE::UInt32 begin
    JCS_UNKNOWN = 0
    JCS_GRAYSCALE = 1
    JCS_RGB = 2
    JCS_YCbCr = 3
    JCS_CMYK = 4
    JCS_YCCK = 5
    JCS_EXT_RGB = 6
    JCS_EXT_RGBX = 7
    JCS_EXT_BGR = 8
    JCS_EXT_BGRX = 9
    JCS_EXT_XBGR = 10
    JCS_EXT_XRGB = 11
    JCS_EXT_RGBA = 12
    JCS_EXT_BGRA = 13
    JCS_EXT_ABGR = 14
    JCS_EXT_ARGB = 15
    JCS_RGB565 = 16
end

@cenum J_DITHER_MODE::UInt32 begin
    JDITHER_NONE = 0
    JDITHER_ORDERED = 1
    JDITHER_FS = 2
end

struct ANONYMOUS1_msg_parm
    s::NTuple{80, UInt8}
end

struct jpeg_error_mgr
    error_exit::Ptr{Cvoid}
    emit_message::Ptr{Cvoid}
    output_message::Ptr{Cvoid}
    format_message::Ptr{Cvoid}
    reset_error_mgr::Ptr{Cvoid}
    msg_code::Cint
    msg_parm::ANONYMOUS1_msg_parm
    trace_level::Cint
    num_warnings::Clong
    jpeg_message_table::Ptr{Cstring}
    last_jpeg_message::Cint
    addon_message_table::Ptr{Cstring}
    first_addon_message::Cint
    last_addon_message::Cint
end

struct jpeg_memory_mgr
    alloc_small::Ptr{Cvoid}
    alloc_large::Ptr{Cvoid}
    alloc_sarray::Ptr{Cvoid}
    alloc_barray::Ptr{Cvoid}
    request_virt_sarray::Ptr{Cvoid}
    request_virt_barray::Ptr{Cvoid}
    realize_virt_arrays::Ptr{Cvoid}
    access_virt_sarray::Ptr{Cvoid}
    access_virt_barray::Ptr{Cvoid}
    free_pool::Ptr{Cvoid}
    self_destruct::Ptr{Cvoid}
    max_memory_to_use::Clong
    max_alloc_chunk::Clong
end

struct jpeg_progress_mgr
    progress_monitor::Ptr{Cvoid}
    pass_counter::Clong
    pass_limit::Clong
    completed_passes::Cint
    total_passes::Cint
end

struct jpeg_common_struct
    err::Ptr{jpeg_error_mgr}
    mem::Ptr{jpeg_memory_mgr}
    progress::Ptr{jpeg_progress_mgr}
    client_data::Ptr{Cvoid}
    is_decompressor::boolean
    global_state::Cint
end

const j_common_ptr = Ptr{jpeg_common_struct}

struct jpeg_destination_mgr
    next_output_byte::Ptr{JOCTET}
    free_in_buffer::Cint
    init_destination::Ptr{Cvoid}
    empty_output_buffer::Ptr{Cvoid}
    term_destination::Ptr{Cvoid}
end

struct jpeg_comp_master
    dummy::Clong
end

struct jpeg_c_main_controller
    dummy::Clong
end

struct jpeg_c_prep_controller
    dummy::Clong
end

struct jpeg_c_coef_controller
    dummy::Clong
end

struct jpeg_marker_writer
    dummy::Clong
end

struct jpeg_color_converter
    dummy::Clong
end

struct jpeg_downsampler
    dummy::Clong
end

struct jpeg_forward_dct
    dummy::Clong
end

struct jpeg_entropy_encoder
    dummy::Clong
end

struct jpeg_compress_struct
    err::Ptr{jpeg_error_mgr}
    mem::Ptr{jpeg_memory_mgr}
    progress::Ptr{jpeg_progress_mgr}
    client_data::Ptr{Cvoid}
    is_decompressor::boolean
    global_state::Cint
    dest::Ptr{jpeg_destination_mgr}
    image_width::JDIMENSION
    image_height::JDIMENSION
    input_components::Cint
    in_color_space::J_COLOR_SPACE
    input_gamma::Cdouble
    data_precision::Cint
    num_components::Cint
    jpeg_color_space::J_COLOR_SPACE
    comp_info::Ptr{jpeg_component_info}
    quant_tbl_ptrs::NTuple{4, Ptr{JQUANT_TBL}}
    dc_huff_tbl_ptrs::NTuple{4, Ptr{JHUFF_TBL}}
    ac_huff_tbl_ptrs::NTuple{4, Ptr{JHUFF_TBL}}
    arith_dc_L::NTuple{16, UINT8}
    arith_dc_U::NTuple{16, UINT8}
    arith_ac_K::NTuple{16, UINT8}
    num_scans::Cint
    scan_info::Ptr{jpeg_scan_info}
    raw_data_in::boolean
    arith_code::boolean
    optimize_coding::boolean
    CCIR601_sampling::boolean
    smoothing_factor::Cint
    dct_method::J_DCT_METHOD
    restart_interval::UInt32
    restart_in_rows::Cint
    write_JFIF_header::boolean
    JFIF_major_version::UINT8
    JFIF_minor_version::UINT8
    density_unit::UINT8
    X_density::UINT16
    Y_density::UINT16
    write_Adobe_marker::boolean
    next_scanline::JDIMENSION
    progressive_mode::boolean
    max_h_samp_factor::Cint
    max_v_samp_factor::Cint
    total_iMCU_rows::JDIMENSION
    comps_in_scan::Cint
    cur_comp_info::NTuple{4, Ptr{jpeg_component_info}}
    MCUs_per_row::JDIMENSION
    MCU_rows_in_scan::JDIMENSION
    blocks_in_MCU::Cint
    MCU_membership::NTuple{10, Cint}
    Ss::Cint
    Se::Cint
    Ah::Cint
    Al::Cint
    master::Ptr{jpeg_comp_master}
    main::Ptr{jpeg_c_main_controller}
    prep::Ptr{jpeg_c_prep_controller}
    coef::Ptr{jpeg_c_coef_controller}
    marker::Ptr{jpeg_marker_writer}
    cconvert::Ptr{jpeg_color_converter}
    downsample::Ptr{jpeg_downsampler}
    fdct::Ptr{jpeg_forward_dct}
    entropy::Ptr{jpeg_entropy_encoder}
    script_space::Ptr{jpeg_scan_info}
    script_space_size::Cint
end

const j_compress_ptr = Ptr{jpeg_compress_struct}

struct jpeg_source_mgr
    next_input_byte::Ptr{JOCTET}
    bytes_in_buffer::Cint
    init_source::Ptr{Cvoid}
    fill_input_buffer::Ptr{Cvoid}
    skip_input_data::Ptr{Cvoid}
    resync_to_restart::Ptr{Cvoid}
    term_source::Ptr{Cvoid}
end

struct jpeg_decomp_master
    dummy::Clong
end

struct jpeg_d_main_controller
    dummy::Clong
end

struct jpeg_d_coef_controller
    dummy::Clong
end

struct jpeg_d_post_controller
    dummy::Clong
end

struct jpeg_input_controller
    dummy::Clong
end

struct jpeg_marker_reader
    dummy::Clong
end

struct jpeg_entropy_decoder
    dummy::Clong
end

struct jpeg_inverse_dct
    dummy::Clong
end

struct jpeg_upsampler
    dummy::Clong
end

struct jpeg_color_deconverter
    dummy::Clong
end

struct jpeg_color_quantizer
    dummy::Clong
end

struct jpeg_decompress_struct
    err::Ptr{jpeg_error_mgr}
    mem::Ptr{jpeg_memory_mgr}
    progress::Ptr{jpeg_progress_mgr}
    client_data::Ptr{Cvoid}
    is_decompressor::boolean
    global_state::Cint
    src::Ptr{jpeg_source_mgr}
    image_width::JDIMENSION
    image_height::JDIMENSION
    num_components::Cint
    jpeg_color_space::J_COLOR_SPACE
    out_color_space::J_COLOR_SPACE
    scale_num::UInt32
    scale_denom::UInt32
    output_gamma::Cdouble
    buffered_image::boolean
    raw_data_out::boolean
    dct_method::J_DCT_METHOD
    do_fancy_upsampling::boolean
    do_block_smoothing::boolean
    quantize_colors::boolean
    dither_mode::J_DITHER_MODE
    two_pass_quantize::boolean
    desired_number_of_colors::Cint
    enable_1pass_quant::boolean
    enable_external_quant::boolean
    enable_2pass_quant::boolean
    output_width::JDIMENSION
    output_height::JDIMENSION
    out_color_components::Cint
    output_components::Cint
    rec_outbuf_height::Cint
    actual_number_of_colors::Cint
    colormap::JSAMPARRAY
    output_scanline::JDIMENSION
    input_scan_number::Cint
    input_iMCU_row::JDIMENSION
    output_scan_number::Cint
    output_iMCU_row::JDIMENSION
    coef_bits::Ptr{Cvoid}
    quant_tbl_ptrs::NTuple{4, Ptr{JQUANT_TBL}}
    dc_huff_tbl_ptrs::NTuple{4, Ptr{JHUFF_TBL}}
    ac_huff_tbl_ptrs::NTuple{4, Ptr{JHUFF_TBL}}
    data_precision::Cint
    comp_info::Ptr{jpeg_component_info}
    progressive_mode::boolean
    arith_code::boolean
    arith_dc_L::NTuple{16, UINT8}
    arith_dc_U::NTuple{16, UINT8}
    arith_ac_K::NTuple{16, UINT8}
    restart_interval::UInt32
    saw_JFIF_marker::boolean
    JFIF_major_version::UINT8
    JFIF_minor_version::UINT8
    density_unit::UINT8
    X_density::UINT16
    Y_density::UINT16
    saw_Adobe_marker::boolean
    Adobe_transform::UINT8
    CCIR601_sampling::boolean
    marker_list::jpeg_saved_marker_ptr
    max_h_samp_factor::Cint
    max_v_samp_factor::Cint
    min_DCT_scaled_size::Cint
    total_iMCU_rows::JDIMENSION
    sample_range_limit::Ptr{JSAMPLE}
    comps_in_scan::Cint
    cur_comp_info::NTuple{4, Ptr{jpeg_component_info}}
    MCUs_per_row::JDIMENSION
    MCU_rows_in_scan::JDIMENSION
    blocks_in_MCU::Cint
    MCU_membership::NTuple{10, Cint}
    Ss::Cint
    Se::Cint
    Ah::Cint
    Al::Cint
    unread_marker::Cint
    master::Ptr{jpeg_decomp_master}
    main::Ptr{jpeg_d_main_controller}
    coef::Ptr{jpeg_d_coef_controller}
    post::Ptr{jpeg_d_post_controller}
    inputctl::Ptr{jpeg_input_controller}
    marker::Ptr{jpeg_marker_reader}
    entropy::Ptr{jpeg_entropy_decoder}
    idct::Ptr{jpeg_inverse_dct}
    upsample::Ptr{jpeg_upsampler}
    cconvert::Ptr{jpeg_color_deconverter}
    cquantize::Ptr{jpeg_color_quantizer}
end

const j_decompress_ptr = Ptr{jpeg_decompress_struct}

struct jvirt_sarray_control
    dummy::Clong
end

const jvirt_sarray_ptr = Ptr{jvirt_sarray_control}

struct jvirt_barray_control
    dummy::Clong
end

const jvirt_barray_ptr = Ptr{jvirt_barray_control}
const jpeg_marker_parser_method = Ptr{Cvoid}
const TJ_NUMSAMP = 6
const TJ_NUMPF = 12
const TJ_NUMCS = 5
const TJFLAG_BOTTOMUP = 2
const TJFLAG_FASTUPSAMPLE = 256
const TJFLAG_NOREALLOC = 1024
const TJFLAG_FASTDCT = 2048
const TJFLAG_ACCURATEDCT = 4096
const TJFLAG_STOPONWARNING = 8192
const TJFLAG_PROGRESSIVE = 16384
const TJ_NUMERR = 2
const TJ_NUMXOP = 8
const TJXOPT_PERFECT = 1
const TJXOPT_TRIM = 2
const TJXOPT_CROP = 4
const TJXOPT_GRAY = 8
const TJXOPT_NOOUTPUT = 16
const TJXOPT_PROGRESSIVE = 32
const TJXOPT_COPYNONE = 64

# Skipping MacroDefinition: TJPAD ( width ) ( ( ( width ) + 3 ) & ( ~ 3 ) )
# Skipping MacroDefinition: TJSCALED ( dimension , scalingFactor ) ( ( dimension * scalingFactor . num + scalingFactor . denom - 1 ) / scalingFactor . denom )

const TJFLAG_FORCEMMX = 8
const TJFLAG_FORCESSE = 16
const TJFLAG_FORCESSE2 = 32
const TJFLAG_FORCESSE3 = 128
const NUMSUBOPT = TJ_NUMSAMP

@cenum TJSAMP::UInt32 begin
    TJSAMP_444 = 0
    TJSAMP_422 = 1
    TJSAMP_420 = 2
    TJSAMP_GRAY = 3
    TJSAMP_440 = 4
    TJSAMP_411 = 5
end

const TJ_444 = TJSAMP_444
const TJ_422 = TJSAMP_422
const TJ_420 = TJSAMP_420
const TJ_411 = TJSAMP_420
const TJ_GRAYSCALE = TJSAMP_GRAY
const TJ_BGR = 1
const TJ_BOTTOMUP = TJFLAG_BOTTOMUP
const TJ_FORCEMMX = TJFLAG_FORCEMMX
const TJ_FORCESSE = TJFLAG_FORCESSE
const TJ_FORCESSE2 = TJFLAG_FORCESSE2
const TJ_ALPHAFIRST = 64
const TJ_FORCESSE3 = TJFLAG_FORCESSE3
const TJ_FASTUPSAMPLE = TJFLAG_FASTUPSAMPLE
const TJ_YUV = 512

@cenum TJPF::Int32 begin
    TJPF_RGB = 0
    TJPF_BGR = 1
    TJPF_RGBX = 2
    TJPF_BGRX = 3
    TJPF_XBGR = 4
    TJPF_XRGB = 5
    TJPF_GRAY = 6
    TJPF_RGBA = 7
    TJPF_BGRA = 8
    TJPF_ABGR = 9
    TJPF_ARGB = 10
    TJPF_CMYK = 11
    TJPF_UNKNOWN = -1
end

@cenum TJCS::UInt32 begin
    TJCS_RGB = 0
    TJCS_YCbCr = 1
    TJCS_GRAY = 2
    TJCS_CMYK = 3
    TJCS_YCCK = 4
end

@cenum TJERR::UInt32 begin
    TJERR_WARNING = 0
    TJERR_FATAL = 1
end

@cenum TJXOP::UInt32 begin
    TJXOP_NONE = 0
    TJXOP_HFLIP = 1
    TJXOP_VFLIP = 2
    TJXOP_TRANSPOSE = 3
    TJXOP_TRANSVERSE = 4
    TJXOP_ROT90 = 5
    TJXOP_ROT180 = 6
    TJXOP_ROT270 = 7
end

struct tjscalingfactor
    num::Cint
    denom::Cint
end

struct tjregion
    x::Cint
    y::Cint
    w::Cint
    h::Cint
end

struct tjtransform
    r::tjregion
    op::Cint
    options::Cint
    data::Ptr{Cvoid}
    customFilter::Ptr{Cvoid}
end

const tjhandle = Ptr{Cvoid}


text:
# Eckstein, Bertsekas, "On the Douglas-Rachford Splitting Method and the
# Proximal Point Algorithm for Maximal Monotone Operators",
# Mathematical Programming, vol. 55, no. 1, pp. 293-318 (1989).

using Base.Iterators
using ProximalCore: Zero
using LinearAlgebra
using Printf

"""
    DouglasRachfordIteration(; <keyword-arguments>)

Iterator implementing the Douglas-Rachford splitting algorithm [1].

This iterator solves convex optimization problems of the form

    minimize f(x) + g(x).

See also: [`DouglasRachford`](@ref).

# Arguments
- `x0`: initial point.
- `f=Zero()`: proximable objective term.
- `g=Zero()`: proximable objective term.
- `gamma`: stepsize to use.

# References
1. Eckstein, Bertsekas, "On the Douglas-Rachford Splitting Method and the Proximal Point Algorithm for Maximal Monotone Operators", Mathematical Programming, vol. 55, no. 1, pp. 293-318 (1989).
"""
Base.@kwdef struct DouglasRachfordIteration{R,C<:Union{R,Complex{R}},Tx<:AbstractArray{C},Tf,Tg}
    f::Tf = Zero()
    g::Tg = Zero()
    x0::Tx
    gamma::R
end

Base.IteratorSize(::Type{<:DouglasRachfordIteration}) = Base.IsInfinite()

Base.@kwdef struct DouglasRachfordState{Tx}
    x::Tx
    y::Tx = similar(x)
    r::Tx = similar(x)
    z::Tx = similar(x)
    res::Tx = similar(x)
end

function Base.iterate(iter::DouglasRachfordIteration, state::DouglasRachfordState = DouglasRachfordState(x=copy(iter.x0)))
    prox!(state.y, iter.f, state.x, iter.gamma)
    state.r .= 2 .* state.y .- state.x
    prox!(state.z, iter.g, state.r, iter.gamma)
    state.res .= state.y .- state.z
    state.x .-= state.res
    return state, state
end

default_stopping_criterion(tol, iter::DouglasRachfordIteration, state::DouglasRachfordState) = norm(state.res, Inf) / iter.gamma <= tol
default_solution(::DouglasRachfordIteration, state::DouglasRachfordState) = state.y
default_display(it, iter::DouglasRachfordIteration, state::DouglasRachfordState) = @printf("%5d | %.3e\n", it, norm(state.res, Inf) / iter.gamma)

"""
    DouglasRachford(; <keyword-arguments>)

Constructs the Douglas-Rachford splitting algorithm [1].

This algorithm solves convex optimization problems of the form

    minimize f(x) + g(x).

The returned object has type `IterativeAlgorithm{DouglasRachfordIteration}`,
and can be called with the problem's arguments to trigger its solution.

See also: [`DouglasRachfordIteration`](@ref), [`IterativeAlgorithm`](@ref).

# Arguments
- `maxit::Int=1_000`: maximum number of iteration
- `tol::1e-8`: tolerance for the default stopping criterion
- `stop::Function`: termination condition, `stop(::T, state)` should return `true` when to stop the iteration
- `solution::Function`: solution mapping, `solution(::T, state)` should return the identified solution
- `verbose::Bool=false`: whether the algorithm state should be displayed
- `freq::Int=100`: every how many iterations to display the algorithm state
- `display::Function`: display function, `display(::Int, ::T, state)` should display a summary of the iteration state
- `kwargs...`: additional keyword arguments to pass on to the `DouglasRachfordIteration` constructor upon call

# References
1. Eckstein, Bertsekas, "On the Douglas-Rachford Splitting Method and the Proximal Point Algorithm for Maximal Monotone Operators", Mathematical Programming, vol. 55, no. 1, pp. 293-318 (1989).
"""
DouglasRachford(;
    maxit=1_000,
    tol=1e-8,
    stop=(iter, state) -> default_stopping_criterion(tol, iter, state),
    solution=default_solution,
    verbose=false,
    freq=100,
    display=default_display,
    kwargs...
) = IterativeAlgorithm(DouglasRachfordIteration; maxit, stop, solution, verbose, freq, display, kwargs...)

ext: jl


text:
#####
##### Truncated exponential distribition
#####

function mean(d::Truncated{<:Exponential,Continuous})
    θ = d.untruncated.θ
    l, r = extrema(d)           # l is always finite
    if isfinite(r)
        if abs(l-r) ≤ √eps()*θ
            # linear is a good approximation, just take the midpoint
            middle(l, r)
        else
            Δ = r - l
            R = -Δ/θ
            θ + middle(l, r) + Δ/2*(exp(R)+1)/expm1(R)
        end
    else
        θ + l
    end
end


text:
using PowerLAPACK
using Base.Test

include("test_stev.jl")
include("test_stegr.jl")


text:
fs2()

@testset "(no)show" begin
    lit = raw"""
        # A

        1 + 1

        # B

        2^2;

        # C

        println("hello")

        # done.
        """
    lp = mkpath(joinpath(F.PATHS[:folder], "_literate"))
    write(joinpath(lp, "ex1.jl"), lit)

    s = raw"""
        @def showall = true
        INI

        \literate{/_literate/ex1}
        """

    h = s |> fd2html_td
    @test isapproxstr(h, """

INI

A

1 + 1

2

B

2^2;

C

println("hello")

hello

done.

        """)
end


text:
using ROOT, Histograms, ROOTHistograms
using Base.Test

h = ErrorHistogram([-Inf, 0,1,2,3,4, Inf])
for i=1:100
    push!(h, 0.3)
end
th = to_root(h, "hist1")
_h = from_root(th)
@test all(edges(h)[1] .== edges(_h)[1])
@test all(contents(h) .== contents(_h))
@test all(errors(h) .== errors(_h))

h = ErrorHistogram([-Inf, 0,1,2,3,4, Inf])
for i=1:100
    push!(h, 0.3, 0.1)
end
th = to_root(h, "hist2")
_h = from_root(th)
@test all(edges(h)[1] .== edges(_h)[1])
@test all(contents(h) .== contents(_h))
@test all(errors(h) .== errors(_h))

nh = ErrorHistogram([-Inf, 0,1,2, Inf], [-Inf, 0,1,2, Inf])
for i=1:100
    push!(nh, (0.3, 0.3))
end
th = to_root(nh, "nhist")
nh2 = from_root(th)
@test nbins(nh) == nbins(nh2)
@test all(edges(nh)[1] .== edges(nh2)[1])
@test all(edges(nh)[2] .== edges(nh2)[2])

@test all(errors(nh) .== errors(nh2))
@test all(contents(nh) .== contents(nh2))

tf = ROOT.TFile("tfile.root", "RECREATE")
h = ErrorHistogram([-Inf, linspace(-1, 1, 30)..., Inf])

for i=1:1000000
    push!(h, rand(-1:0.0001:1))
end
th = to_root(h, "hist3")
h2 = from_root(th)
Write(th)
Close(tf)

hd = load_hists_from_file("tfile.root")
h = hd["hist3"]

write_hists_to_file("tfile2.root", Dict("/hist3"=>h); verbose=true)
hd2 = load_hists_from_file("tfile.root")

ROOT.gROOT.process_line("TFile* tf = new TFile(\"tfile.root\");")
ROOT.gROOT.process_line("TH1D* h = (TH1D*)(tf->Get(\"hist3\"));")
for i=1:nbins(h)[1]
    @test contents(h)[i] == ROOT.gROOT.process_line("h->GetBinContent($(i-1));")
end


text:
using Base.Test
using OptimTools

if !isdefined(:probs) || isempty(probs)
	println("getting test problems")
	include("getTestFunctions.jl")
end

his = []; flag = []; x0 = [];

firstOrderMethods = (sd,bfgs,nlcg,sr1)
# try stopping based on atol
for method in firstOrderMethods
	println("testing $(string(method))")
	for k=1:length(probs)
		prob = probs[k]

		println("\t\t$(prob[1])")

		fk   = prob[2]
		dfk  = prob[3]
		xsol = float(prob[5])
		x0   = float(xsol) + .01*randn(size(xsol))*norm(xsol)
		atol = 1e-4

		xsd,flag,his = method(fk,dfk, x0,maxIter=1000000,atol=atol,out=1*(k==2))

		@test all(diff(his[:,1]).<=0)
		@test norm(dfk(xsd)) .< atol
	end
end


text:
"""
    function vader()

Cowth Vader, from geordan@csua.berkeley.edu

# Example

```jldoctest
julia> cowsay("Luke, I am your father!", cow=Cowsay.vader)
 _________________________
< Luke, I am your father! >
 -------------------------
        \\    ,-^-.
         \\   !oYo!
          \\ /./=\\.\\______
               ##        )\\/\\
                ||-----w||
                ||      ||

               Cowth Vader
```
"""
function vader(;eyes="oo", tongue="  ", thoughts="\\")
the_cow =
"""
        $thoughts    ,-^-.
         $thoughts   !oYo!
          $thoughts /./=\\.\\______
               ##        )\\/\\
                ||-----w||
                ||      ||

               Cowth Vader
"""
return the_cow
end


text:
# ---
# title: 417. Pacific Atlantic Water Flow
# id: problem417
# author: Indigo
# date: 2021-06-20
# difficulty: Medium
# categories: Depth-first Search, Breadth-first Search
# link: <https://leetcode.com/problems/pacific-atlantic-water-flow/description/>
# hidden: true
# ---
#
# Given an `m x n` matrix of non-negative integers representing the height of
# each unit cell in a continent, the "Pacific ocean" touches the left and top
# edges of the matrix and the "Atlantic ocean" touches the right and bottom
# edges.
#
# Water can only flow in four directions (up, down, left, or right) from a cell
# to another one with height equal or lower.
#
# Find the list of grid coordinates where water can flow to both the Pacific and
# Atlantic ocean.
#
# **Note:**
#
#   1. The order of returned grid coordinates does not matter.
#   2. Both _m_ and _n_ are less than 150.
#
#
#
# **Example:**
#
#
#
#     Given the following 5x5 matrix:
#
#       Pacific ~   ~   ~   ~   ~
#            ~  1   2   2   3  (5) *
#            ~  3   2   3  (4) (4) *
#            ~  2   4  (5)  3   1  *
#            ~ (6) (7)  1   4   5  *
#            ~ (5)  1   1   2   4  *
#               *   *   *   *   * Atlantic
#
#     Return:
#
#     [[0, 4], [1, 3], [1, 4], [2, 2], [3, 0], [3, 1], [4, 0]] (positions with parentheses in above matrix).
#
#
#
#
#
## @lc code=start
using LeetCode

function pacific_atlantic(heights::Matrix{Int})
    r, c = size(heights)
    visited = fill(false, r, c)
    res = fill(0x0, r, c)
    res[1:end, 1] .= 0x1
    res[1, 1:end] .= 0x1
    res[end, 1:end] .= 0x2
    res[1:end, end] .= 0x2
    res[1, end] = res[end, 1] = 0x3
    dirs = [(1, 0), (-1, 0), (0, 1), (0, -1)]

    function dfs(x, y)
        visited[x, y] = true
        for dir in dirs
            nx, ny = x + dir[1], y + dir[2]
            (0 < nx <= r && 0 < ny <= c) || continue
            if heights[x, y] <= heights[nx, ny]
                res[nx, ny] |= res[x, y]
                !visited[nx, ny] && dfs(nx, ny)
            end
        end
    end
    for i in 1:r
        dfs(i, 1), dfs(i, c)
    end
    for j in 1:c
        dfs(1, j), dfs(r, j)
    end
    r = Set{Tuple{Int, Int}}()
    for cidx in CartesianIndices(res)
        res[cidx] == 0x3 && push!(r, cidx.I)
    end
    return r
end
## @lc code=end


text:
include("euler/euler.jl")
using .BigIntegers: BigInteger

compute(n::Int, list_numbers::String)::SubString = sum(map(BigInteger, split(list_numbers, "\n")))[1:n]

max_stars_repo_name: Dynortice/Project-Euler

max_issues_repo_name: Dynortice/Project-Euler

max_forks_repo_name: Dynortice/Project-Euler


text:
using LinearAlgebra
using PyPlot
using PolynomialBasis
using ImplicitDomainQuadrature
using Revise
using CutCellDG
include("../../../../test/useful_routines.jl")
include("transformation-elasticity-solver.jl")

function angular_position(points)
    cpoints = points[1, :] + im * points[2, :]
    return rad2deg.(angle.(cpoints))
end

K1, K2 = 247.0, 192.0    # Pa
mu1, mu2 = 126.0, 87.0   # Pa
lambda1 = lame_lambda(K1, mu1)
lambda2 = lame_lambda(K2, mu2)
stiffness = CutCellDG.HookeStiffness(lambda1, mu1, lambda2, mu2)

theta0 = -0.067
p0 = -0.0
stiffness = CutCellDG.HookeStiffness(lambda1, mu1, lambda2, mu2)
transfstress =
    CutCellDG.plane_strain_transformation_stress(lambda1, mu1, theta0)

meshwidth = [1.0, 1.0]
delta = 1e-2meshwidth[1]
nelmts = 3
polyorder = 2
numqp = required_quadrature_order(polyorder) + 2
penaltyfactor = 1e2

folderpath = "examples/traction-continuity-with-transformation/cylindrical-particle/cylindrical-bc/"
filename = "unequal-moduli-pure-transformation"

dx = minimum(meshwidth) / nelmts
penalty = penaltyfactor / dx * 0.5 * (lambda1 + mu1 + lambda2 + mu2)

basis = TensorProductBasis(2, polyorder)
interfacecenter = [0.5, 0.5]
interfaceradius = dx / sqrt(2) + delta
outerradius = 2.0
analyticalsolution = AnalyticalSolution(
    interfaceradius,
    outerradius,
    interfacecenter,
    lambda1,
    mu1,
    lambda2,
    mu2,
    theta0,
    p0,
)

mesh, cellquads, facequads, interfacequads = construct_mesh_and_quadratures(
    meshwidth,
    nelmts,
    basis,
    interfacecenter,
    interfaceradius,
    numqp
)

nodaldisplacement = nodal_displacement(
    mesh,
    basis,
    cellquads,
    facequads,
    interfacequads,
    stiffness,
    theta0,
    analyticalsolution,
    penalty,
)

L2error = mesh_L2_error(
    reshape(nodaldisplacement, 2, :),
    analyticalsolution,
    basis,
    cellquads,
    mesh,
)
exactsolutionL2error =
    integral_norm_on_mesh(analyticalsolution, cellquads, mesh, 2)
normalizedL2error = L2error ./ exactsolutionL2error

refseedpoints, spatialseedpoints, seedcellids =
    CutCellDG.seed_zero_levelset_with_interfacequads(interfacequads, mesh)
# checkcellids = [8,9]
# refseedpoints, spatialseedpoints, seedcellids =
#     CutCellDG.seed_zero_levelset_with_interfacequads(
#         interfacequads,
#         mesh,
#         checkcellids,
#     )

normals = CutCellDG.collect_interface_normals(interfacequads, mesh)
# normals = CutCellDG.collect_interface_normals(interfacequads,mesh,checkcellids)

spatialpoints = spatialseedpoints[1, :, :]
referencepoints = refseedpoints
referencecellids = seedcellids

relspatialpoints = spatialpoints .- interfacecenter
angularposition = angular_position(relspatialpoints)
sortidx = sortperm(angularposition)
angularposition = angularposition[sortidx]

referencepoints = referencepoints[:, :, sortidx]
referencecellids = referencecellids[:, sortidx]
spatialpoints = spatialpoints[:, sortidx]
normals = normals[:, sortidx]

productdisplacement = CutCellDG.displacement_at_reference_points(
    nodaldisplacement,
    basis,
    referencepoints,
    referencecellids,
    +1,
    mesh,
)
parentdisplacement = CutCellDG.displacement_at_reference_points(
    nodaldisplacement,
    basis,
    referencepoints,
    referencecellids,
    -1,
    mesh,
)
exactdisplacement = mapslices(analyticalsolution, spatialpoints, dims = 1)

fig,ax = PyPlot.subplots(2,1)
ax[1].plot(angularposition,productdisplacement[1,:],label="product u1")
ax[1].plot(angularposition,parentdisplacement[1,:],label="parent u1")
ax[1].plot(angularposition,exactdisplacement[1,:],"--",label="exact")
ax[2].plot(angularposition,productdisplacement[2,:],label="product u1")
ax[2].plot(angularposition,parentdisplacement[2,:],label="parent u1")
ax[2].plot(angularposition,exactdisplacement[2,:],"--",label="exact")
ax[1].grid()
ax[2].grid()
ax[1].legend()
ax[2].legend()
fig
#
# productdisplacementmagnitude =
#     vec(mapslices(norm, productdisplacement, dims = 1))
# parentdisplacementmagnitude = vec(mapslices(norm, parentdisplacement, dims = 1))
# exactdisplacementmagnitude = vec(mapslices(norm, exactdisplacement, dims = 1))
#
# parentdisplacementerror =
#     abs.(parentdisplacementmagnitude - exactdisplacementmagnitude) ./
#     exactdisplacementmagnitude
# productdisplacementerror =
#     abs.(productdisplacementmagnitude - exactdisplacementmagnitude) ./
#     exactdisplacementmagnitude
#
# fig, ax = PyPlot.subplots()
# ax.plot(angularposition, parentdisplacementerror, label = "parent")
# ax.plot(angularposition, productdisplacementerror, label = "product")
# ax.legend()
# ax.grid()
# ax.set_ylim(0,0.15)
# ax.set_xlim(0,90)
# ax.set_title("DG + Merging: Displacement Error")
# fig
# # fig.savefig(folderpath*filename*"-displacement-error.png")
#
#
# productstress = product_stress_at_reference_points(
#     nodaldisplacement,
#     basis,
#     stiffness,
#     transfstress,
#     theta0,
#     referencepoints,
#     referencecellids,
#     mesh,
# )
# parentstress = parent_stress_at_reference_points(
#     nodaldisplacement,
#     basis,
#     stiffness,
#     referencepoints,
#     referencecellids,
#     mesh,
# )
# exactstress =
#     mapslices(x -> exact_stress(analyticalsolution, x), spatialpoints, dims = 1)
#
# producttraction = CutCellDG.traction_force_at_points(productstress, normals)
# parenttraction = CutCellDG.traction_force_at_points(parentstress, normals)
# exacttraction = CutCellDG.traction_force_at_points(exactstress, normals)
#
# # fig, ax = PyPlot.subplots(2, 1)
# # ax[1].plot(angularposition, producttraction[1, :], label = "product")
# # ax[1].plot(angularposition, parenttraction[1, :], label = "parent")
# # ax[1].plot(angularposition, exacttraction[1, :], "--", label = "exact")
# # ax[1].set_title("t1")
# # ax[1].legend()
# # ax[1].grid()
# # ax[2].plot(angularposition, producttraction[2, :], label = "product")
# # ax[2].plot(angularposition, parenttraction[2, :], label = "parent")
# # ax[2].plot(angularposition, exacttraction[2, :], "--", label = "exact")
# # ax[2].set_title("t2")
# # ax[2].legend()
# # ax[2].grid()
# # fig.tight_layout()
# # fig
#
#
# producttractionmagnitude = vec(mapslices(norm, producttraction, dims = 1))
# parenttractionmagnitude = vec(mapslices(norm, parenttraction, dims = 1))
# exacttractionmagnitude = vec(mapslices(norm, exacttraction, dims = 1))
#
# producttractionerror =
#     abs.(producttractionmagnitude - exacttractionmagnitude) ./
#     exacttractionmagnitude
# parenttractionerror =
#     abs.(parenttractionmagnitude - exacttractionmagnitude) ./
#     exacttractionmagnitude
#
# fig, ax = PyPlot.subplots()
# ax.plot(angularposition, parenttractionerror, label = "parent")
# ax.plot(angularposition, producttractionerror, label = "product")
# ax.legend()
# ax.grid()
# ax.set_xlim(0,90)
# ax.set_ylim(0,10.0)
# ax.set_title("DG + Merging: Traction Error")
# fig
# # fig.savefig(folderpath*filename*"-traction-error.png")


text:
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: app_mesh
using AWS.Compat
using AWS.UUIDs

"""
    CreateGatewayRoute()

Creates a gateway route. A gateway route is attached to a virtual gateway and routes traffic to an existing virtual service. If a route matches a request, it can distribute traffic to a target virtual service. For more information about gateway routes, see Gateway routes.

# Required Parameters
- `gatewayRouteName`: The name to use for the gateway route.
- `meshName`: The name of the service mesh to create the gateway route in.
- `spec`: The gateway route specification to apply.
- `virtualGatewayName`: The name of the virtual gateway to associate the gateway route with. If the virtual gateway is in a shared mesh, then you must be the owner of the virtual gateway resource.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.
- `tags`: Optional metadata that you can apply to the gateway route to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_gateway_route(gatewayRouteName, meshName, spec, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes", Dict{String, Any}("gatewayRouteName"=>gatewayRouteName, "spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_gateway_route(gatewayRouteName, meshName, spec, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("gatewayRouteName"=>gatewayRouteName, "spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    CreateMesh()

Creates a service mesh.  A service mesh is a logical boundary for network traffic between services that are represented by resources within the mesh. After you create your service mesh, you can create virtual services, virtual nodes, virtual routers, and routes to distribute traffic between the applications in your mesh. For more information about service meshes, see Service meshes.

# Required Parameters
- `meshName`: The name to use for the service mesh.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `spec`: The service mesh specification to apply.
- `tags`: Optional metadata that you can apply to the service mesh to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_mesh(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes", Dict{String, Any}("meshName"=>meshName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_mesh(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("meshName"=>meshName, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    CreateRoute()

Creates a route that is associated with a virtual router.  You can route several different protocols and define a retry policy for a route. Traffic can be routed to one or more virtual nodes. For more information about routes, see Routes.

# Required Parameters
- `meshName`: The name of the service mesh to create the route in.
- `routeName`: The name to use for the route.
- `spec`: The route specification to apply.
- `virtualRouterName`: The name of the virtual router in which to create the route. If the virtual router is in a shared mesh, then you must be the owner of the virtual router resource.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.
- `tags`: Optional metadata that you can apply to the route to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_route(meshName, routeName, spec, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes", Dict{String, Any}("routeName"=>routeName, "spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_route(meshName, routeName, spec, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("routeName"=>routeName, "spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    CreateVirtualGateway()

Creates a virtual gateway. A virtual gateway allows resources outside your mesh to communicate to resources that are inside your mesh. The virtual gateway represents an Envoy proxy running in an Amazon ECS task, in a Kubernetes service, or on an Amazon EC2 instance. Unlike a virtual node, which represents an Envoy running with an application, a virtual gateway represents Envoy deployed by itself. For more information about virtual gateways, see Virtual gateways.

# Required Parameters
- `meshName`: The name of the service mesh to create the virtual gateway in.
- `spec`: The virtual gateway specification to apply.
- `virtualGatewayName`: The name to use for the virtual gateway.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.
- `tags`: Optional metadata that you can apply to the virtual gateway to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_virtual_gateway(meshName, spec, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateways", Dict{String, Any}("spec"=>spec, "virtualGatewayName"=>virtualGatewayName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_virtual_gateway(meshName, spec, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateways", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "virtualGatewayName"=>virtualGatewayName, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    CreateVirtualNode()

Creates a virtual node within a service mesh.  A virtual node acts as a logical pointer to a particular task group, such as an Amazon ECS service or a Kubernetes deployment. When you create a virtual node, you can specify the service discovery information for your task group, and whether the proxy running in a task group will communicate with other proxies using Transport Layer Security (TLS). You define a listener for any inbound traffic that your virtual node expects. Any virtual service that your virtual node expects to communicate to is specified as a backend. The response metadata for your new virtual node contains the arn that is associated with the virtual node. Set this value to the full ARN; for example, arn:aws:appmesh:us-west-2:123456789012:myMesh/default/virtualNode/myApp) as the APPMESH_RESOURCE_ARN environment variable for your task group's Envoy proxy container in your task definition or pod spec. This is then mapped to the node.id and node.cluster Envoy parameters.  By default, App Mesh uses the name of the resource you specified in APPMESH_RESOURCE_ARN when Envoy is referring to itself in metrics and traces. You can override this behavior by setting the APPMESH_RESOURCE_CLUSTER environment variable with your own name. AWS Cloud Map is not available in the eu-south-1 Region.  For more information about virtual nodes, see Virtual nodes. You must be using 1.15.0 or later of the Envoy image when setting these variables. For more information about App Mesh Envoy variables, see Envoy image in the AWS App Mesh User Guide.

# Required Parameters
- `meshName`: The name of the service mesh to create the virtual node in.
- `spec`: The virtual node specification to apply.
- `virtualNodeName`: The name to use for the virtual node.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.
- `tags`: Optional metadata that you can apply to the virtual node to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_virtual_node(meshName, spec, virtualNodeName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualNodes", Dict{String, Any}("spec"=>spec, "virtualNodeName"=>virtualNodeName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_virtual_node(meshName, spec, virtualNodeName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualNodes", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "virtualNodeName"=>virtualNodeName, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    CreateVirtualRouter()

Creates a virtual router within a service mesh. Specify a listener for any inbound traffic that your virtual router receives. Create a virtual router for each protocol and port that you need to route. Virtual routers handle traffic for one or more virtual services within your mesh. After you create your virtual router, create and associate routes for your virtual router that direct incoming requests to different virtual nodes. For more information about virtual routers, see Virtual routers.

# Required Parameters
- `meshName`: The name of the service mesh to create the virtual router in.
- `spec`: The virtual router specification to apply.
- `virtualRouterName`: The name to use for the virtual router.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.
- `tags`: Optional metadata that you can apply to the virtual router to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_virtual_router(meshName, spec, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouters", Dict{String, Any}("spec"=>spec, "virtualRouterName"=>virtualRouterName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_virtual_router(meshName, spec, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouters", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "virtualRouterName"=>virtualRouterName, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    CreateVirtualService()

Creates a virtual service within a service mesh. A virtual service is an abstraction of a real service that is provided by a virtual node directly or indirectly by means of a virtual router. Dependent services call your virtual service by its virtualServiceName, and those requests are routed to the virtual node or virtual router that is specified as the provider for the virtual service. For more information about virtual services, see Virtual services.

# Required Parameters
- `meshName`: The name of the service mesh to create the virtual service in.
- `spec`: The virtual service specification to apply.
- `virtualServiceName`: The name to use for the virtual service.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then the account that you specify must share the mesh with your account before you can create the resource in the service mesh. For more information about mesh sharing, see Working with shared meshes.
- `tags`: Optional metadata that you can apply to the virtual service to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
"""
create_virtual_service(meshName, spec, virtualServiceName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualServices", Dict{String, Any}("spec"=>spec, "virtualServiceName"=>virtualServiceName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_virtual_service(meshName, spec, virtualServiceName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualServices", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "virtualServiceName"=>virtualServiceName, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    DeleteGatewayRoute()

Deletes an existing gateway route.

# Required Parameters
- `gatewayRouteName`: The name of the gateway route to delete.
- `meshName`: The name of the service mesh to delete the gateway route from.
- `virtualGatewayName`: The name of the virtual gateway to delete the route from.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
delete_gateway_route(gatewayRouteName, meshName, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes/$(gatewayRouteName)"; aws_config=aws_config)
delete_gateway_route(gatewayRouteName, meshName, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes/$(gatewayRouteName)", args; aws_config=aws_config)

"""
    DeleteMesh()

Deletes an existing service mesh. You must delete all resources (virtual services, routes, virtual routers, and virtual nodes) in the service mesh before you can delete the mesh itself.

# Required Parameters
- `meshName`: The name of the service mesh to delete.

"""
delete_mesh(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)"; aws_config=aws_config)
delete_mesh(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)", args; aws_config=aws_config)

"""
    DeleteRoute()

Deletes an existing route.

# Required Parameters
- `meshName`: The name of the service mesh to delete the route in.
- `routeName`: The name of the route to delete.
- `virtualRouterName`: The name of the virtual router to delete the route in.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
delete_route(meshName, routeName, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes/$(routeName)"; aws_config=aws_config)
delete_route(meshName, routeName, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes/$(routeName)", args; aws_config=aws_config)

"""
    DeleteVirtualGateway()

Deletes an existing virtual gateway. You cannot delete a virtual gateway if any gateway routes are associated to it.

# Required Parameters
- `meshName`: The name of the service mesh to delete the virtual gateway from.
- `virtualGatewayName`: The name of the virtual gateway to delete.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
delete_virtual_gateway(meshName, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualGateways/$(virtualGatewayName)"; aws_config=aws_config)
delete_virtual_gateway(meshName, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualGateways/$(virtualGatewayName)", args; aws_config=aws_config)

"""
    DeleteVirtualNode()

Deletes an existing virtual node. You must delete any virtual services that list a virtual node as a service provider before you can delete the virtual node itself.

# Required Parameters
- `meshName`: The name of the service mesh to delete the virtual node in.
- `virtualNodeName`: The name of the virtual node to delete.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
delete_virtual_node(meshName, virtualNodeName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualNodes/$(virtualNodeName)"; aws_config=aws_config)
delete_virtual_node(meshName, virtualNodeName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualNodes/$(virtualNodeName)", args; aws_config=aws_config)

"""
    DeleteVirtualRouter()

Deletes an existing virtual router. You must delete any routes associated with the virtual router before you can delete the router itself.

# Required Parameters
- `meshName`: The name of the service mesh to delete the virtual router in.
- `virtualRouterName`: The name of the virtual router to delete.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
delete_virtual_router(meshName, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualRouters/$(virtualRouterName)"; aws_config=aws_config)
delete_virtual_router(meshName, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualRouters/$(virtualRouterName)", args; aws_config=aws_config)

"""
    DeleteVirtualService()

Deletes an existing virtual service.

# Required Parameters
- `meshName`: The name of the service mesh to delete the virtual service in.
- `virtualServiceName`: The name of the virtual service to delete.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
delete_virtual_service(meshName, virtualServiceName; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualServices/$(virtualServiceName)"; aws_config=aws_config)
delete_virtual_service(meshName, virtualServiceName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("DELETE", "/v20190125/meshes/$(meshName)/virtualServices/$(virtualServiceName)", args; aws_config=aws_config)

"""
    DescribeGatewayRoute()

Describes an existing gateway route.

# Required Parameters
- `gatewayRouteName`: The name of the gateway route to describe.
- `meshName`: The name of the service mesh that the gateway route resides in.
- `virtualGatewayName`: The name of the virtual gateway that the gateway route is associated with.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_gateway_route(gatewayRouteName, meshName, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes/$(gatewayRouteName)"; aws_config=aws_config)
describe_gateway_route(gatewayRouteName, meshName, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes/$(gatewayRouteName)", args; aws_config=aws_config)

"""
    DescribeMesh()

Describes an existing service mesh.

# Required Parameters
- `meshName`: The name of the service mesh to describe.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_mesh(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)"; aws_config=aws_config)
describe_mesh(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)", args; aws_config=aws_config)

"""
    DescribeRoute()

Describes an existing route.

# Required Parameters
- `meshName`: The name of the service mesh that the route resides in.
- `routeName`: The name of the route to describe.
- `virtualRouterName`: The name of the virtual router that the route is associated with.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_route(meshName, routeName, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes/$(routeName)"; aws_config=aws_config)
describe_route(meshName, routeName, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes/$(routeName)", args; aws_config=aws_config)

"""
    DescribeVirtualGateway()

Describes an existing virtual gateway.

# Required Parameters
- `meshName`: The name of the service mesh that the gateway route resides in.
- `virtualGatewayName`: The name of the virtual gateway to describe.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_virtual_gateway(meshName, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateways/$(virtualGatewayName)"; aws_config=aws_config)
describe_virtual_gateway(meshName, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateways/$(virtualGatewayName)", args; aws_config=aws_config)

"""
    DescribeVirtualNode()

Describes an existing virtual node.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual node resides in.
- `virtualNodeName`: The name of the virtual node to describe.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_virtual_node(meshName, virtualNodeName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualNodes/$(virtualNodeName)"; aws_config=aws_config)
describe_virtual_node(meshName, virtualNodeName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualNodes/$(virtualNodeName)", args; aws_config=aws_config)

"""
    DescribeVirtualRouter()

Describes an existing virtual router.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual router resides in.
- `virtualRouterName`: The name of the virtual router to describe.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_virtual_router(meshName, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouters/$(virtualRouterName)"; aws_config=aws_config)
describe_virtual_router(meshName, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouters/$(virtualRouterName)", args; aws_config=aws_config)

"""
    DescribeVirtualService()

Describes an existing virtual service.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual service resides in.
- `virtualServiceName`: The name of the virtual service to describe.

# Optional Parameters
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
describe_virtual_service(meshName, virtualServiceName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualServices/$(virtualServiceName)"; aws_config=aws_config)
describe_virtual_service(meshName, virtualServiceName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualServices/$(virtualServiceName)", args; aws_config=aws_config)

"""
    ListGatewayRoutes()

Returns a list of existing gateway routes that are associated to a virtual gateway.

# Required Parameters
- `meshName`: The name of the service mesh to list gateway routes in.
- `virtualGatewayName`: The name of the virtual gateway to list gateway routes in.

# Optional Parameters
- `limit`: The maximum number of results returned by ListGatewayRoutes in paginated output. When you use this parameter, ListGatewayRoutes returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListGatewayRoutes request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListGatewayRoutes returns up to 100 results and a nextToken value if applicable.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
- `nextToken`: The nextToken value returned from a previous paginated ListGatewayRoutes request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_gateway_routes(meshName, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes"; aws_config=aws_config)
list_gateway_routes(meshName, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes", args; aws_config=aws_config)

"""
    ListMeshes()

Returns a list of existing service meshes.

# Optional Parameters
- `limit`: The maximum number of results returned by ListMeshes in paginated output. When you use this parameter, ListMeshes returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListMeshes request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListMeshes returns up to 100 results and a nextToken value if applicable.
- `nextToken`: The nextToken value returned from a previous paginated ListMeshes request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.  This token should be treated as an opaque identifier that is used only to retrieve the next items in a list and not for other programmatic purposes.
"""
list_meshes(; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes"; aws_config=aws_config)
list_meshes(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes", args; aws_config=aws_config)

"""
    ListRoutes()

Returns a list of existing routes in a service mesh.

# Required Parameters
- `meshName`: The name of the service mesh to list routes in.
- `virtualRouterName`: The name of the virtual router to list routes in.

# Optional Parameters
- `limit`: The maximum number of results returned by ListRoutes in paginated output. When you use this parameter, ListRoutes returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListRoutes request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListRoutes returns up to 100 results and a nextToken value if applicable.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
- `nextToken`: The nextToken value returned from a previous paginated ListRoutes request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_routes(meshName, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes"; aws_config=aws_config)
list_routes(meshName, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes", args; aws_config=aws_config)

"""
    ListTagsForResource()

List the tags for an App Mesh resource.

# Required Parameters
- `resourceArn`: The Amazon Resource Name (ARN) that identifies the resource to list the tags for.

# Optional Parameters
- `limit`: The maximum number of tag results returned by ListTagsForResource in paginated output. When this parameter is used, ListTagsForResource returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListTagsForResource request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListTagsForResource returns up to 100 results and a nextToken value if applicable.
- `nextToken`: The nextToken value returned from a previous paginated ListTagsForResource request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_tags_for_resource(resourceArn; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/tags", Dict{String, Any}("resourceArn"=>resourceArn); aws_config=aws_config)
list_tags_for_resource(resourceArn, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/tags", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("resourceArn"=>resourceArn), args)); aws_config=aws_config)

"""
    ListVirtualGateways()

Returns a list of existing virtual gateways in a service mesh.

# Required Parameters
- `meshName`: The name of the service mesh to list virtual gateways in.

# Optional Parameters
- `limit`: The maximum number of results returned by ListVirtualGateways in paginated output. When you use this parameter, ListVirtualGateways returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListVirtualGateways request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListVirtualGateways returns up to 100 results and a nextToken value if applicable.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
- `nextToken`: The nextToken value returned from a previous paginated ListVirtualGateways request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_virtual_gateways(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateways"; aws_config=aws_config)
list_virtual_gateways(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualGateways", args; aws_config=aws_config)

"""
    ListVirtualNodes()

Returns a list of existing virtual nodes.

# Required Parameters
- `meshName`: The name of the service mesh to list virtual nodes in.

# Optional Parameters
- `limit`: The maximum number of results returned by ListVirtualNodes in paginated output. When you use this parameter, ListVirtualNodes returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListVirtualNodes request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListVirtualNodes returns up to 100 results and a nextToken value if applicable.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
- `nextToken`: The nextToken value returned from a previous paginated ListVirtualNodes request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_virtual_nodes(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualNodes"; aws_config=aws_config)
list_virtual_nodes(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualNodes", args; aws_config=aws_config)

"""
    ListVirtualRouters()

Returns a list of existing virtual routers in a service mesh.

# Required Parameters
- `meshName`: The name of the service mesh to list virtual routers in.

# Optional Parameters
- `limit`: The maximum number of results returned by ListVirtualRouters in paginated output. When you use this parameter, ListVirtualRouters returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListVirtualRouters request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListVirtualRouters returns up to 100 results and a nextToken value if applicable.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
- `nextToken`: The nextToken value returned from a previous paginated ListVirtualRouters request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_virtual_routers(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouters"; aws_config=aws_config)
list_virtual_routers(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualRouters", args; aws_config=aws_config)

"""
    ListVirtualServices()

Returns a list of existing virtual services in a service mesh.

# Required Parameters
- `meshName`: The name of the service mesh to list virtual services in.

# Optional Parameters
- `limit`: The maximum number of results returned by ListVirtualServices in paginated output. When you use this parameter, ListVirtualServices returns only limit results in a single page along with a nextToken response element. You can see the remaining results of the initial request by sending another ListVirtualServices request with the returned nextToken value. This value can be between 1 and 100. If you don't use this parameter, ListVirtualServices returns up to 100 results and a nextToken value if applicable.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
- `nextToken`: The nextToken value returned from a previous paginated ListVirtualServices request where limit was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.
"""
list_virtual_services(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualServices"; aws_config=aws_config)
list_virtual_services(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("GET", "/v20190125/meshes/$(meshName)/virtualServices", args; aws_config=aws_config)

"""
    TagResource()

Associates the specified tags to a resource with the specified resourceArn. If existing tags on a resource aren't specified in the request parameters, they aren't changed. When a resource is deleted, the tags associated with that resource are also deleted.

# Required Parameters
- `resourceArn`: The Amazon Resource Name (ARN) of the resource to add tags to.
- `tags`: The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

"""
tag_resource(resourceArn, tags; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/tag", Dict{String, Any}("resourceArn"=>resourceArn, "tags"=>tags); aws_config=aws_config)
tag_resource(resourceArn, tags, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/tag", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("resourceArn"=>resourceArn, "tags"=>tags), args)); aws_config=aws_config)

"""
    UntagResource()

Deletes specified tags from a resource.

# Required Parameters
- `resourceArn`: The Amazon Resource Name (ARN) of the resource to delete tags from.
- `tagKeys`: The keys of the tags to be removed.

"""
untag_resource(resourceArn, tagKeys; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/untag", Dict{String, Any}("resourceArn"=>resourceArn, "tagKeys"=>tagKeys); aws_config=aws_config)
untag_resource(resourceArn, tagKeys, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/untag", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("resourceArn"=>resourceArn, "tagKeys"=>tagKeys), args)); aws_config=aws_config)

"""
    UpdateGatewayRoute()

Updates an existing gateway route that is associated to a specified virtual gateway in a service mesh.

# Required Parameters
- `gatewayRouteName`: The name of the gateway route to update.
- `meshName`: The name of the service mesh that the gateway route resides in.
- `spec`: The new gateway route specification to apply. This overwrites the existing data.
- `virtualGatewayName`: The name of the virtual gateway that the gateway route is associated with.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
update_gateway_route(gatewayRouteName, meshName, spec, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes/$(gatewayRouteName)", Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
update_gateway_route(gatewayRouteName, meshName, spec, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateway/$(virtualGatewayName)/gatewayRoutes/$(gatewayRouteName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    UpdateMesh()

Updates an existing service mesh.

# Required Parameters
- `meshName`: The name of the service mesh to update.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `spec`: The service mesh specification to apply.
"""
update_mesh(meshName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)", Dict{String, Any}("clientToken"=>string(uuid4())); aws_config=aws_config)
update_mesh(meshName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    UpdateRoute()

Updates an existing route for a specified service mesh and virtual router.

# Required Parameters
- `meshName`: The name of the service mesh that the route resides in.
- `routeName`: The name of the route to update.
- `spec`: The new route specification to apply. This overwrites the existing data.
- `virtualRouterName`: The name of the virtual router that the route is associated with.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
update_route(meshName, routeName, spec, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes/$(routeName)", Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
update_route(meshName, routeName, spec, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouter/$(virtualRouterName)/routes/$(routeName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    UpdateVirtualGateway()

Updates an existing virtual gateway in a specified service mesh.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual gateway resides in.
- `spec`: The new virtual gateway specification to apply. This overwrites the existing data.
- `virtualGatewayName`: The name of the virtual gateway to update.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
update_virtual_gateway(meshName, spec, virtualGatewayName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateways/$(virtualGatewayName)", Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
update_virtual_gateway(meshName, spec, virtualGatewayName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualGateways/$(virtualGatewayName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    UpdateVirtualNode()

Updates an existing virtual node in a specified service mesh.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual node resides in.
- `spec`: The new virtual node specification to apply. This overwrites the existing data.
- `virtualNodeName`: The name of the virtual node to update.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
update_virtual_node(meshName, spec, virtualNodeName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualNodes/$(virtualNodeName)", Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
update_virtual_node(meshName, spec, virtualNodeName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualNodes/$(virtualNodeName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    UpdateVirtualRouter()

Updates an existing virtual router in a specified service mesh.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual router resides in.
- `spec`: The new virtual router specification to apply. This overwrites the existing data.
- `virtualRouterName`: The name of the virtual router to update.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
update_virtual_router(meshName, spec, virtualRouterName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouters/$(virtualRouterName)", Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
update_virtual_router(meshName, spec, virtualRouterName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualRouters/$(virtualRouterName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)

"""
    UpdateVirtualService()

Updates an existing virtual service in a specified service mesh.

# Required Parameters
- `meshName`: The name of the service mesh that the virtual service resides in.
- `spec`: The new virtual service specification to apply. This overwrites the existing data.
- `virtualServiceName`: The name of the virtual service to update.

# Optional Parameters
- `clientToken`: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
- `meshOwner`: The AWS IAM account ID of the service mesh owner. If the account ID is not your own, then it's the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
"""
update_virtual_service(meshName, spec, virtualServiceName; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualServices/$(virtualServiceName)", Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())); aws_config=aws_config)
update_virtual_service(meshName, spec, virtualServiceName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = app_mesh("PUT", "/v20190125/meshes/$(meshName)/virtualServices/$(virtualServiceName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("spec"=>spec, "clientToken"=>string(uuid4())), args)); aws_config=aws_config)