text:
export  evaluate_offdiagbasis!,
        evaluate_offdiagbasis,
        evaluate_diagbasis!,
        evaluate_diagbasis,
        grad_xd_diagbasis!,
        grad_xd_diagbasis,
        hess_xd_diagbasis!,
        hess_xd_diagbasis,
        evaluate!,
        evaluate,
        grad_xd!,
        grad_xd,
        hess_xd!,
        hess_xd,
        grad_coeff!,
        grad_coeff,
        grad_coeff_grad_xd!,
        grad_coeff_grad_xd

## evaluate_offdiagbasis
# X::Array{Float64,2}

"""
$(TYPEDSIGNATURES)

Evaluates in-place the basis of `ExpandedFunction` `f` for the ensemble matrix `X` along the off-diagonal state dimensions for the set of multi-indices of features `idx`
"""
evaluate_offdiagbasis!(ψoff, f::ExpandedFunction, X, idx::Array{Int64,2}) =
    evaluate_basis!(ψoff, f, X, 1:f.Nx-1, idx)

evaluate_offdiagbasis!(ψoff, f::ExpandedFunction, X) =
    evaluate_offdiagbasis!(ψoff, f, X, f.idx)

evaluate_offdiagbasis(f::ExpandedFunction, X, idx::Array{Int64,2}) =
    evaluate_offdiagbasis!(zeros(size(X,2), size(idx,1)), f, X, idx)

evaluate_offdiagbasis(f::ExpandedFunction, X) =
    evaluate_offdiagbasis!(zeros(size(X,2), size(f.idx,1)), f, X)

## evaluate_diagbasis

# evaluate_diagbasis!(ψoff, f::ExpandedFunction{m, Nψ, Nx}, X::Array{Float64,2}, idx::Array{Int64,2}) where {m, Nψ, Nx} =
"""
$(TYPEDSIGNATURES)

Evaluates in-place the basis of `ExpandedFunction` `f` for the ensemble matrix `X` along the last state dimension for the set of multi-indices of features `idx`
"""
evaluate_diagbasis!(ψoff, f::ExpandedFunction, X, idx::Array{Int64,2}) =
    evaluate_basis!(ψoff, f, X, [f.Nx], idx)

evaluate_diagbasis!(ψoff, f::ExpandedFunction, X) =
    evaluate_diagbasis!(ψoff, f, X, f.idx)

evaluate_diagbasis(f::ExpandedFunction, X, idx::Array{Int64,2}) =
        evaluate_diagbasis!(zeros(size(X,2), size(idx,1)), f, X, idx)

evaluate_diagbasis(f::ExpandedFunction, X) =
        evaluate_diagbasis!(zeros(size(X,2), size(f.idx,1)), f, X)

## grad_xd_diagbasis

# grad_xk_basis!(dkψ, f, X, k, grad_dim, dims, idx) where {m, Nψ, Nx}

 # Evaluate derivatives of basis of x_{d}

# grad_xd_diagbasis!(dψxd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64,2}) =
"""
$(TYPEDSIGNATURES)

Evaluates in-place gradient of the basis of the last component, with respect to the last component for the set of multi-indices of features `idx`
"""
grad_xd_diagbasis!(dψxd::Array{Float64,2}, f::ExpandedFunction, X, idx::Array{Int64,2}) =
                  grad_xk_basis!(dψxd, f, X, 1, f.Nx, f.Nx, idx)

grad_xd_diagbasis!(dψxd::Array{Float64,2}, f::ExpandedFunction, X) =
                  grad_xd_diagbasis(dψxd, f, X, 1, f.Nx, f.Nx, f.idx)

grad_xd_diagbasis(f::ExpandedFunction, X, idx::Array{Int64,2}) =
                 grad_xd_diagbasis!(zeros(size(X,2), size(idx,1)), f, X, idx)

grad_xd_diagbasis(f::ExpandedFunction, X) =
                 grad_xd_diagbasis!(zeros(size(X,2), size(f.idx,1)), f, X, f.idx)

## hess_xd_diagbasis

# Evaluate second derivatives of basis of x_{d}
"""
$(TYPEDSIGNATURES)

Evaluates in-place the hessian of the basis of the last component, with respect to the last component for the set of multi-indices of features `idx`
"""
hess_xd_diagbasis!(d2ψxd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64,2}, idx::Array{Int64,2}) =
                  grad_xk_basis!(d2ψxd, f, X, 2, f.Nx, f.Nx, idx)

hess_xd_diagbasis!(d2ψxd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64,2}) =
                  hess_xd_diagbasis(d2ψxd, f, X, 2, f.Nx, f.Nx, f.idx)

hess_xd_diagbasis(f::ExpandedFunction, X::Array{Float64,2}, idx::Array{Int64,2}) =
                 hess_xd_diagbasis!(zeros(size(X,2), size(idx,1)), f, X, idx)

hess_xd_diagbasis(f::ExpandedFunction, X::Array{Float64,2}) =
                 hess_xd_diagbasis!(zeros(size(X,2), size(f.idx,1)), f, X, f.idx)

## evaluate!
"""
$(TYPEDSIGNATURES)

Evaluates in-place the features of multi-indices `idx` for the ensemble matrix `X`.
"""
function evaluate!(ψ::Array{Float64,1}, ψoff::Array{Float64,2}, ψd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
    @assert size(ψ,1) == size(X,2) "Wrong dimension of the output vector ψ"
    evaluate_offdiagbasis!(ψoff, f, X, idx)
    evaluate_diagbasis!(ψd, f, X, idx)
    elementproductmatmul!(ψ, ψoff, ψd, f.coeff)
    return ψ
end

evaluate!(ψ::Array{Float64,1}, ψoff::Array{Float64,2}, ψd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64, 2}) =
         evaluate!(ψ, ψoff, ψd, f, X, f.idx)

"""
$(TYPEDSIGNATURES)

Evaluates the features of multi-indices `idx` for the ensemble matrix `X`.
"""
function evaluate(f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
    Ne = size(X,2)
    evaluate!(zeros(Ne), zeros(Ne, size(idx,1)), zeros(Ne, size(idx,1)), f, X, idx)
end
#
# function evaluate(f::ExpandedFunction, X::Array{Float64, 2})
#     Ne = size(X,2)
#     evaluate!(zeros(Ne), zeros(Ne, size(f.idx,1)), zeros(Ne, size(f.idx,1)), f, X, f.idx)
# end

## grad_xd!
"""
$(TYPEDSIGNATURES)

Computes in-place the gradient with respect to the last component of the features with multi-indices `idx` for the ensemble matrix `X`.
"""
function grad_xd!(dψ::Array{Float64,1}, ψoff::Array{Float64,2}, dψxd::Array{Float64,2}, f::ExpandedFunction, X, idx::Array{Int64,2})
    @assert size(dψ,1) == size(X,2) "Wrong dimension of the output vector ψ"
    evaluate_offdiagbasis!(ψoff, f, X, idx)
    grad_xd_diagbasis!(dψxd, f, X, idx)
    elementproductmatmul!(dψ, ψoff, dψxd, f.coeff)
    return dψ
end

grad_xd!(dψ::Array{Float64,1}, ψoff::Array{Float64,2}, dψxd::Array{Float64,2}, f::ExpandedFunction, X) =
        grad_xd!(dψ, ψoff, dψxd, f, X, f.idx)

# function grad_xd(f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
"""
$(TYPEDSIGNATURES)

Computes the gradient with respect to the last component of the features with multi-indices `idx` for the ensemble matrix `X`.
"""
function grad_xd(f::ExpandedFunction, X, idx::Array{Int64,2})
    Ne = size(X,2)
    grad_xd!(zeros(Ne), zeros(Ne, size(idx,1)), zeros(Ne, size(idx,1)), f, X, idx)
end

"""
$(TYPEDSIGNATURES)

Computes the gradient with respect to the last component of `ExpandedFunction` `f` for the ensemble matrix `X`.
"""
function grad_xd(f::ExpandedFunction, X)
    Ne = size(X,2)
    grad_xd!(zeros(Ne), zeros(Ne, size(f.idx,1)), zeros(Ne, size(f.idx,1)), f, X, f.idx)
end

## hess_xd!
#     ψ = evaluate_offdiagbasis(f, X)
#     d2ψxd = hess_xd_diagbasis(f, X)
#     return ψ .* d2ψxd * f.coeff
"""
$(TYPEDSIGNATURES)

Computes in-place the hessian with respect to the last component of the features with multi-indices `idx` for the ensemble matrix `X`.
"""
function hess_xd!(d2ψ::Array{Float64,1}, ψoff::Array{Float64,2}, d2ψxd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
    @assert size(d2ψ,1) == size(X,2) "Wrong dimension of the output vector ψ"
    evaluate_offdiagbasis!(ψoff, f, X, idx)
    hess_xd_diagbasis!(d2ψxd, f, X, idx)
    elementproductmatmul!(d2ψ, ψoff, d2ψxd, f.coeff)
    return d2ψ
end

hess_xd!(d2ψ::Array{Float64,1}, ψoff::Array{Float64,2}, d2ψxd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64, 2}) =
        hess_xd!(d2ψ, ψoff, d2ψxd, f, X, f.idx)

"""
$(TYPEDSIGNATURES)

Computes the hessian with respect to the last component of the features with multi-indices `idx` for the ensemble matrix `X`.
"""
function hess_xd(f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
    Ne = size(X,2)
    hess_xd!(zeros(Ne), zeros(Ne, size(idx,1)), zeros(Ne, size(idx,1)), f, X, idx)
end
#
# function hess_xd(f::ExpandedFunction, X::Array{Float64, 2})
#     Ne = size(X,2)
#     hess_xd!(zeros(Ne), zeros(Ne, size(f.idx,1)), zeros(Ne, size(f.idx,1)), f, X, f.idx)
# end

## grad_coeff!

"""
$(TYPEDSIGNATURES)

Computes in-place the gradient with respect to the coefficients of the features with multi-indices `idx` for the ensemble matrix `X`.
"""
function grad_coeff!(dcψ::Array{Float64,2}, ψoff::Array{Float64,2}, ψd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
    @assert size(dcψ,1) == size(X,2) "Wrong dimension of the output vector ψ"
    # evaluate_basis!(dcψ, f, X, 1:Nx, idx)
    evaluate_offdiagbasis!(ψoff, f, X, idx)
    evaluate_diagbasis!(ψd, f, X)
    dcψ .= ψoff .* ψd
    return dcψ
end

grad_coeff!(dcψ::Array{Float64,2}, ψoff::Array{Float64,2}, ψd::Array{Float64,2}, f::ExpandedFunction, X::Array{Float64, 2}) =
         grad_coeff!(dcψ, ψoff, ψd, f, X, f.idx)

 """
 $(TYPEDSIGNATURES)

 Computes the gradient with respect to the coefficients of the features with multi-indices `idx` for the ensemble matrix `X`.
 """
function grad_coeff(f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
         grad_coeff!(zeros(size(X,2), size(idx,1)), zeros(size(X,2), size(idx,1)), zeros(size(X,2), size(idx,1)), f, X, idx)
end

# function grad_coeff(f::ExpandedFunction, X::Array{Float64, 2})
#          grad_coeff!(zeros(size(X,2), size(f.idx,1)), zeros(size(X,2), size(f.idx,1)), zeros(size(X,2), size(f.idx,1)), f, X, f.idx)
# end

## grad_coeff_grad_xd!
"""
$(TYPEDSIGNATURES)

Computes in-place ∂_c ∂_x{k} (∑_{α ∈ idx} c_{α} ψ_{α}(x_{1:k})).
"""
function grad_coeff_grad_xd!(dcdψxd::Array{Float64,2}, ψoff::Array{Float64,2}, dψd::Array{Float64,2},f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
    @assert size(dcdψxd,1) == size(X,2) "Wrong dimension of the output vector ψ"
    # evaluate_basis!(dcψ, f, X, 1:Nx, idx)
    evaluate_offdiagbasis!(ψoff, f, X, idx)
    grad_xd_diagbasis!(dψd, f, X, idx)
    dcdψxd .= ψoff .* dψd
    return dcdψxd
end

grad_coeff_grad_xd!(dcdψxd::Array{Float64,2}, ψoff::Array{Float64,2}, dψd::Array{Float64,2},f::ExpandedFunction, X::Array{Float64, 2}) =
    grad_coeff_grad_xd!(dcdψxd, ψoff, dψd, f, X, f.idx)

# function grad_coeff_grad_xd(f::ExpandedFunction, X::Array{Float64, 2}, idx::Array{Int64,2})
#          grad_coeff_grad_xd!(zeros(size(X,2), size(idx,1)), zeros(size(X,2), size(idx,1)), zeros(size(X,2), size(idx,1)), f, X, idx)
# end
#
# function grad_coeff_grad_xd(f::ExpandedFunction, X::Array{Float64, 2})
#          grad_coeff_grad_xd!(zeros(size(X,2), size(f.idx,1)), zeros(size(X,2), size(f.idx,1)), zeros(size(X,2), size(f.idx,1)), f, X, f.idx)
# end


text:
"""
	storage_signature(blob, directory, container, storageaccount, storagekey, timestamp)

Signature for [`get_blob`](@ref).
All arguments are strings.
"""
function storage_signature(blob, directory, container, storageaccount, storagekey, timestamp)
	time_arg = signature_time(timestamp)

    location_arg = string("/", storageaccount, "/", container, "/", directory, "/", blob)

	signature = storage_signature("GET", "", "", time_arg, location_arg)

	encode_storagekey(storagekey, signature)
end

"""
	storage_signature(content, blob, directory, container, storageaccount, storagekey, timestamp, contenttype)

Signature for [`put_blob`](@ref).
All arguments are strings.
"""
function storage_signature(content, blob, directory, container, storageaccount, storagekey, timestamp, contenttype)
	# TODO: Check that contenttype is valid?
	time_arg = signature_time(timestamp, "x-ms-blob-type:Blockblob")

    location_arg = string("/", storageaccount, "/", container, "/", directory, "/", blob)

	signature = storage_signature("PUT", contentsize(content), contenttype, time_arg, location_arg)

	encode_storagekey(storagekey, signature)
end

function storage_signature(verb, contentsize, contenttype, time_arg, location_arg)
    string(verb, "\n\n\n", contentsize, "\n\n", contenttype,
		   "\n\n\n\n\n\n\n", time_arg, "\n", location_arg)
end

# ------------------------------------------------------------------------------

"""
	encode_storagekey(storagekey, signature)

Encode the storage key using a signature string from [`storage_signature`](@ref).
"""
function encode_storagekey(storagekey, signature)
    # TODO: Check that storagekey is UTF8 encoded
	@pipe storagekey |>
		Base64.base64decode |>
		Nettle.digest("sha256", _, signature) |>
		Base64.base64encode
end

# ------------------------------------------------------------------------------

"""
signature_time(timestamp[, headers])

Include the time stamp information for the signature.
"""
function signature_time(timestamp::Dates.DateTime)
	timestamp |>
		http_date |>
    	signature_time
end

function signature_time(timestamp::String)
  	string("x-ms-date:", timestamp, "\nx-ms-version:", X_MS_VERSION)
end

function signature_time(timestamp, headers)
	@pipe timestamp |>
		signature_time |>
		string(headers, "\n", _)
end

# ------------------------------------------------------------------------------

"""
Return the content size of an object as needed in [`storage_signature`](@ref).

## Examples

```jldoctest
julia> contentsize("foo")
"3"
```
"""
contentsize(obj::String) = length(obj) |> string

# ------------------------------------------------------------------------------

"""
Print `DateTime` in RFC 1123 format as required by the REST interface.

The RFC 1123 expects to have "GMT" (aka UTC) at the end of the string,
cf. <https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings>.
"""
http_date(dt::Dates.DateTime) = Dates.format(dt, RFC1123_GMT)

function http_date(dt::TimeZones.ZonedDateTime)
	@pipe TimeZones.astimezone(dt, UTC) |>
		Dates.format(_, RFC1123_GMT)
end

function now_http_date()
	@pipe Dates.now() |>
		TimeZones.ZonedDateTime(_, LOCALZONE) |>
		http_date
end

ext: jl

max_stars_repo_name: robertdj/AzureBlob

max_issues_repo_name: robertdj/AzureBlob

max_forks_repo_name: robertdj/AzureBlob


text:
include("preamble.jl")

using InteractiveUtils: code_llvm, code_warntype
using Statistics: mean

using Transducers: Reduction, start, __foldl__, __simple_foldl__

"""
    llvm_ir(f, args) :: String

Get LLVM IR of `f(args...)` as a string.
"""
llvm_ir(f, args) = sprint(code_llvm, f, Base.typesof(args...))

"""
    julia_ir(f, args) :: String

Get Julia IR of `f(args...)` as a string.
"""
julia_ir(f, args) = sprint(code_warntype, f, Base.typesof(args...))

matchedlines(r, s) = [m.match for m in eachmatch(r, s)]
anyunions(s) = matchedlines(r".*UNION.*", s)
nmatches(r, s) = count(_ -> true, eachmatch(r, s))

@testset "map!" begin
    xf = Filter(x -> -0.5 < x < 0.5) |> Map(x -> 2x)
    xs = Float64[]
    ys = Float64[]
    ir = llvm_ir(map!, (xf, ys, xs))
    @test nmatches(r"fmul <4 x double>", ir) >= 4
    @test nmatches(r"fcmp [a-z]* <4 x double>", ir) >= 4
end

@testset "PartitionBy" begin
    xf = PartitionBy(x -> x > 0) |>
        Filter(xs -> mean(abs, xs) < 1.0) |>
        Map(prod)

    coll = Float64[]
    rf = Reduction(xf, +, eltype(coll))
    val = start(rf, 0.0)
    @test anyunions(julia_ir(__foldl__, (rf, val, coll))) == []

    # If Julia becomes clever enough to make `__simple_foldl__`
    # type-stable, there is no need to maintain current complex code:
    simple_ir = julia_ir(__simple_foldl__, (rf, val, coll))
    @test !isempty(anyunions(simple_ir))
end


text:
include("1.jl")
function obolochka(r::Robot)
    godownost(r,Sud,Ost)
    kub(r)
end

function godownost(r,side1::HorizonSide,side2::HorizonSide)
    for side in (side1,side2)
        while !isborder(r,side)
            move!(r,side)
        end
    end
end
function kub(r::Robot)
    for side in (Nord,West,Sud,Ost)
        putmarkhole(r,side)
    end
end

max_stars_repo_name: bubasooo/proggggggggg

max_issues_repo_name: bubasooo/proggggggggg

max_forks_repo_name: bubasooo/proggggggggg


text:
using fci
using JLD2
using Combinatorics

@load "_testdata_h4_triplet_alphaconfigs.jld2"
configs = alpha_configs

config = [1,1,1,0]
norbs = 4

@testset "get all configs" begin
    nelecs = UInt8(size(config)[1])
    all_configs_test = unique(collect(permutations(config, size(config)[1])))
    configs_test = [] #empty Array
    for i in 1:size(all_configs_test)[1]
        A = findall(!iszero, all_configs_test[i])
        push!(configs_test,fci.DeterminantString(norbs, nelecs, A, 1, UInt(i)))
    end

    for i in 1:length(configs)
        @test configs[i].config == configs_test[i].config
    end
end

max_stars_repo_name: nbraunsc/fci

max_issues_repo_name: nbraunsc/fci

max_forks_repo_name: nbraunsc/fci


text:
export reformat,reformat3

@doc """ index array data with the first column
""" ->
function index(dt)
    dict = Dict{ASCIIString,Array{ASCIIString,1}}()
    for i = 1:size(dt,1)
        dict[dt[i,1]] = dt[i,2:end]
    end
    dict
end

function reformat(data::Array{ASCIIString,2})
    data = data[2:end,:]
    id_event = Dict{ASCIIString,Set{ASCIIString}}()
    for i in 1:size(data,1)
        id = data[i,1]
        if in(id,keys(id_event))
            push!(id_event[id],data[i,2])
        else
            id_event[id] = Set{ASCIIString}([data[i,2]])
        end
    end

    colname = sort(unique(data[:,2]))
    lencol  = length(colname)
    shape   = length(unique(data[:,1])),length(colname)+1
    result  = Array{ASCIIString,2}(shape)
    for (ind,id) in enumerate(keys(id_event))
        vec = Array{ASCIIString,1}(lencol)
        events = id_event[id]
        for (idx,col) in enumerate(colname)
            if in(col,events)
                vec[idx] = "1"
            else
                vec[idx] = "0"
            end
        end
        result[ind,:] = deepcopy(vcat(id,vec))
    end

    #index array with id
    ret_dict = Dict{ASCIIString,Array{ASCIIString,1}}()
    for i = 1:size(result,1)
        ret_dict[result[i,1]] = result[i,2:end]
    end

    result,ret_dict
end

function reformat3(data::Array{ASCIIString,2})
    data = data[2:end,:]
    #make rowname=>colname index
    id_event = Dict{ASCIIString,Set{Tuple{ASCIIString,ASCIIString}}}()
    for i in 1:size(data,1)
        id = data[i,1]
        if in(id,keys(id_event))
            push!(id_event[id],(data[i,2],data[i,3]))
        else
            id_event[id] = Set{Tuple{ASCIIString,ASCIIString}}([(data[i,2],data[i,3])])
        end
    end

    colname = sort(unique(data[:,2]))
    lencol  = length(colname)
    shape   = length(unique(data[:,1])),length(colname)+1
    result  = Array{ASCIIString,2}(shape)
    for (ind,id) in enumerate(keys(id_event))
        vec = Array{ASCIIString,1}(lencol)
        events = map(x->x[1], collect(id_event[id]))
        for (idx,col) in enumerate(colname)
            if in(col,events)
                vec[idx] = collect(id_event[id])[col .== events][1][2]
            else
                vec[idx] = "0"
            end
        end
        result[ind,:] = deepcopy(vcat(id,vec))
    end

    #index array with id
    ret_dict = Dict{ASCIIString,Array{ASCIIString,1}}()
    for i = 1:size(result,1)
        ret_dict[result[i,1]] = result[i,2:end]
    end

    result,ret_dict
end

@doc """ the last column as lable column, ratio is 6:2:2
assume data doest not contain header part
""" ->
function splitdata{T<:Any}(dt::Array{T,2})
    labels = Set(dt[:,end])
    num_row,num_col = size(dt)
    tr,val,te = Array{T,2}(0,num_col),Array{T,2}(0,num_col),Array{T,2}(0,num_col)

    for lb in labels
        inds = dt[:,end] .== lb
        data = dt[inds,:]
        len = size(data,1)
        trval = Int64(round(len*0.6))
        valte = trval + Int64(round(len*0.2))
        tr  = vcat(tr, data[1:trval,:])
        val = vcat(val,data[trval+1:valte,:])
        te  = vcat(te, data[valte+1:end,:])
    end

    tr,val,te
end

@doc """ shuffle dataset
random indexes of row
""" ->
function shuffle(data)
    m,n = size(data)
    inds = randperm(m)
    data[inds,:]
end


text:
"""
     isschur(A::AbstractMatrix) -> Bool

Test whether `A` is a square matrix in a real or complex Schur form.
In the real case, it is only tested whether A is a quasi upper triangular matrix,
which may have 2x2 diagonal blocks, which however must not correspond to
complex conjugate eigenvalues. In the complex case, it is tested if `A`
is upper triangular.
"""
function isschur(A)
   @assert !Base.has_offset_axes(A)
   m, n = size(A)
   if m != n
      return false
   end
   if m == 1
      return true
   end
   if eltype(A)<:Complex
      return istriu(A)
   else
      if m == 2
         return true
      end
      if istriu(A,-1)
         for i = 1:m-2
             if !iszero(A[i+1,i]) & !iszero(A[i+2,i+1])
                return false
             end
          end
          return true
      else
          return false
      end
   end
end
"""
     isschur(A::AbstractMatrix, B::AbstractMatrix) -> Bool

Test whether `(A,B)` is a pair of square matrices in a real or complex
generalized Schur form.
In the real case, it is only tested whether `B` is upper triangular and `A` is
a quasi upper triangular matrix, which may have 2x2 diagonal blocks, which
however must not correspond to complex conjugate eigenvalues.
In the complex case, it is tested if `A` and `B` are both upper triangular.

"""
function isschur(A,B)
   ma, na = size(A)
   mb, nb = size(B)
   if eltype(A) != eltype(B) || ma != na || mb != nb || na != nb
      return false
   end
   return isschur(A) && istriu(B)
end
"""
    utqu!(Q,U) -> Q

Compute efficiently the symmetric/hermitian product `U'QU -> Q`,
where `Q` is a symmetric/hermitian matrix and `U` is a square matrix.
The resulting product overwrites `Q`.
"""
function utqu!(Q,U)
   n = LinearAlgebra.checksquare(Q)
   if !ishermitian(Q)
      error("Q must be a symmetric/hermitian matrix")
   end
   if LinearAlgebra.checksquare(U) != n
      throw(DimensionMismatch("U must be a matrix of dimension $n x $n"))
   end

   T = promote_type(eltype(Q),eltype(U))
   if !(T <: BlasFloat)
      if T == eltype(Q)
         Q[:,:] = U'*Q*U
         return
      else
         error("TypeError: same type expected for Q and U ")
      end
   end

   idiag = diagind(Q)
   Q[idiag] = Q[idiag]/2
   if isa(U,Adjoint)
      tmp = U.parent*(UpperTriangular(Q)*U)
   else
      tmp = Adjoint(U)*(UpperTriangular(Q)*U)
   end
   #Q = tmp+tmp'
   for j = 1:n
      Q[j,j] = tmp[j,j]+tmp[j,j]'
      for i = j+1:n
         Q[i,j] = tmp[i,j]+tmp[j,i]'
         Q[j,i] = Q[i,j]'
      end
   end
   return Q
end
"""
    X = utqu(Q,U)

Compute efficiently the symmetric/hermitian product `X = U'QU`,
where Q is a symmetric/hermitian matrix.
"""
function utqu(Q,U)
   n = LinearAlgebra.checksquare(Q)
   if !ishermitian(Q)
      error("Q must be a symmetric/hermitian matrix")
   end
   adj = isa(U,Adjoint)
   if adj
      m, n1 = size(U.parent)
      if n1 != n
         throw(DimensionMismatch("U must be a matrix of column dimension $n"))
      end
   else
      n1, m = size(U)
      if n1 != n
         throw(DimensionMismatch("U must be a matrix of row dimension $n"))
      end
   end

   T = promote_type(eltype(Q),eltype(U))
   if !(T <: BlasFloat)
      return U'*Q*U
   end

   t = triu(Q)
   idiag = diagind(Q)
   t[idiag] = t[idiag]/2
   if adj
      t = U.parent*(UpperTriangular(t)*U)
   else
      t = Adjoint(U)*(UpperTriangular(t)*U)
   end
   #X = t+t'
   X = similar(t)
   for j = 1:m
      X[j,j] = t[j,j]+t[j,j]'
      for i = j+1:m
         X[i,j] = t[i,j]+t[j,i]'
         X[j,i] = X[i,j]'
      end
   end
   return X
end

"""
    qrupdate!(R, Y) -> R

Update the upper triangular factor `R` by the
upper triangular factor of the QR factorization  of `[ R; Y' ]`, where `Y` is a
low-rank matrix `Y` (typically with one or two columns). The computation of `R`
only uses `O(n^2)` operations (`n` is the size of `R`). The input matrix `R` is
updated in place and the matrix `Y` is destroyed during the computation.
"""
function qrupdate!(R, Y)
    n, m = size(Y)
    if size(R, 1) != n
      throw(DimensionMismatch("updating matrix must fit size of upper triangular matrix"))
    end
    #Y = conj(Y)
    for k = 1:m
        for i = 1:n

            # Compute Givens rotation
            #c, s, r = LinearAlgebra.givensAlgorithm(R[i,i], conj(Y[i,k]))
            c, s, r = LinearAlgebra.givensAlgorithm(R[i,i], Y[i,k])

            # Store new diagonal element
            R[i,i] = r

            # Update remaining elements in row/column
            for j = i + 1:n
                Rij = R[i,j]
                yjk  = Y[j,k]
                R[i,j]  =   c*Rij + s*yjk
                Y[j,k]    = -s'*Rij + c*yjk
            end
        end
    end
    return R
end
"""

    rqupdate!(R, Y) -> R

Update the upper triangular factor `R` by the
upper triangular factor of the RQ factorization  of `[ Y R]`, where `Y` is a
low-rank matrix `Y` (typically with one or two columns). The computation of `R`
only uses `O(n^2)` operations (`n` is the size of `R`). The input matrix `R` is
updated in place and the matrix `Y` is destroyed during the computation.
"""
function rqupdate!(R, Y)
    n, m = size(Y)
    if size(R, 1) != n
        throw(DimensionMismatch("updating matrix must fit size of upper triangular matrix"))
    end

    for k = 1:m
        for j = n:-1:1

            # Compute Givens rotation
            c, s, r = LinearAlgebra.givensAlgorithm(R[j,j], Y[j,k])

            # Store new diagonal element
            R[j,j] = r

            # Update remaining elements in row/column
            for i = 1: j - 1
                Rij = R[i,j]
                yik  = Y[i,k]
                R[i,j]  =   c*Rij + s*yik
                Y[i,k]    = -s'*Rij + c*yik
            end
        end
    end
    return R
end
"""
    x = triu2vec(Q; rowwise = false, her = false)

Reshape the upper triangular part of the `nxn` array `Q` as a one-dimensional column
vector `x` with `n(n+1)/2` elements. `Q` is assumed symmetric/hermitian if `her = true`.
The elements of `x` correspond to stacking the elements of successive columns
of the upper triangular part of `Q`, if `rowwise = false`, or stacking the elements
of successive rows of the upper triangular part of `Q`, if `rowwise = true`.
"""
function triu2vec(Q::AbstractArray; rowwise = false, her = false)
   n = LinearAlgebra.checksquare(Q)
   if her && !ishermitian(Q)
      error("Q must be a symmetric/hermitian matrix")
   end
   x = Array{eltype(Q),1}(undef,Int(n*(n+1)/2))
   k = 1
   if rowwise
      for i = 1:n
         for j = i:n
             x[k] = Q[i,j]
             k += 1
         end
      end
   else
      for j = 1:n
         for i = 1:j
             x[k] = Q[i,j]
             k += 1
         end
      end
   end
   return x
end
"""
    Q = vec2triu(x; rowwise = false, her = false)

Build from a one-dimensional column vector `x` with `n(n+1)/2` elements
an `nxn` upper triangular matrix `Q` if `her = false` or an `nxn` symetric/hermitian
array `Q` if `her = true`.
The elements of `x` correspond to stacking the elements of successive columns
of the upper triangular part of `Q`, if `rowwise = false`, or stacking the elements
of successive rows of the upper triangular part of `Q`, if `rowwise = true`.
"""
function vec2triu(x::AbstractVector; rowwise = false, her = false)
   k = length(x)
   n = (sqrt(1+8*k)-1)/2
   isinteger(n) ? n = Int(n) : error("The lenght of x must be of the form n(n+1)/2")
   her ? Q = Array{eltype(x),2}(undef,n,n) : Q = zeros(eltype(x),n,n)
   k = 1
   if rowwise
      for i = 1:n
         Q[i,i] = x[k]
         k += 1
         for j = i+1:n
            Q[i,j] = x[k]
            k += 1
         end
      end
   else
      for j = 1:n
         for i = 1:j-1
            Q[i,j] = x[k]
            k += 1
         end
         Q[j,j] = x[k]
         k += 1
      end
   end
   if her
      for j = 1:n
         for i = j+1:n
            Q[i,j] = Q[j,i]'
         end
      end
   end
   return Q
end


text:
using GraphMatFun, LsqFit, LinearAlgebra
include("exp_reset_all.jl");
#include("simulationtools.jl");
include("simulationtools.jl");

f=exp
m=5
target_n=200 # Measure error wrt this discr
n=50;        # Optimize wrt this discr
rho=1.68;  # SID rho m=5

its=5;
droptol0=1e-10;
opt_kwargs=Dict(:logger=> 0,:γ0 => 0.5,:droptol => droptol0,
                :linlsqr => :real_svd,:maxit => its)
base = init_state_mult(f,rho,n,m; eltype=Complex{BigFloat})
base.params[:n]=n;
base.params[:target_n]=target_n;
base.params[:opt_kwargs]=opt_kwargs;

# First the optimization free
sid_org=init_state_mult!(deepcopy(base),:sid,m,showmeta=true)

bbc_org=init_state_mult!(deepcopy(base),:bbc,m,showmeta=true)

datadir=joinpath("..","..","data","exp");
filename=joinpath(datadir,"exp_sastre_m4.cgr");
sastre_org=init_state_file!(deepcopy(base),:sastre,filename,showmeta=true,
                            scale_and_square=true)

#sastre_org.cref=get_degopt_crefs(sastre_org.graph);

ps_org=init_state_mult!(deepcopy(base),:ps,m,showmeta=true)

mono_org=init_state_mult!(deepcopy(base),:mono,m,showmeta=true)

(mono,simlist,commandlist)=
     run_sequence(mono_org,"snsssssssssddssddsssssssssssssdsddGGsssszssddssddskskSssddssddksSSzSKssSzq");

(ps,simlist,commandlist)=
     run_sequence(ps_org,
     "snssssssGGGSddSddSddSSsStddsddsSddSddsddSSSggggggggssSSSSSSGGGGGGGGsSSddsddSddSddSSSddSddStztq");

filename=joinpath(datadir,"exp_sastre_m4_opt_rho0_69.cgr");
sastre_prev=init_state_file!(deepcopy(base),:sastre,filename,showmeta=true,
                            scale_and_square=true)

(sastre,simlist,commandlist)=
     run_sequence(sastre_prev,
                  "SSSnSSNdddddSSdddSSGGSSSSdddSSSSddSSSSSddSddSSddSSSSSzsSzq");

(sid,simlist,commandlist)=
     run_sequence(sid_org,
     "sssssddssssddsssssssssssdddssdddssssdddssdddsssNsssdddsssssssssddds5.7e-18sssddsdsssssszq")

(bbc,simlist,commandlist)=
     run_sequence(bbc_org,
     "ssssdddddddddsSddSgggGGGGGGSSdddSSddSdddgggggggSSSSGGGGGGGSSSdddSSSSddSzq")

include("exp_print_all.jl");
println("Run include(exp_save_all.jl) if you want to save");

max_stars_repo_name: matrixfunctions/GraphMatFunData

max_issues_repo_name: matrixfunctions/GraphMatFunData

max_forks_repo_name: matrixfunctions/GraphMatFunData


text:
using Unmarshal
using Test

# write your own tests here

# Unmarshal tests
include("unmarshal.jl")


text:
# ---
# title: 680. Valid Palindrome II
# id: problem680
# author: Tian Jun
# date: 2020-10-31
# difficulty: Easy
# categories: String
# link: <https://leetcode.com/problems/valid-palindrome-ii/description/>
# hidden: true
# ---
#
# Given a non-empty string `s`, you may delete **at most** one character. Judge
# whether you can make it a palindrome.
#
# **Example 1:**
#
#
#
#     Input: "aba"
#     Output: True
#
#
# **Example 2:**
#
#
#
#     Input: "abca"
#     Output: True
#     Explanation: You could delete the character 'c'.
#
#
# **Note:**
#
#   1. The string will only contain lowercase characters a-z. The maximum length of the string is 50000.
#
#
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end


text:
using SolveDSGE, Plots, DelimitedFiles, DataFrames, CSV
cd(@__DIR__)
include("CKlib.jl")
data = dgp(TrueParameters(), dsge, 1)[1]
plot(data, legend=:outertopright, label=["output" "cons" "hours" "r" "w"])
gui()
#savefig("dsgedata.svg")
#writedlm("dsgedata.txt", data)
df = DataFrame(data, ["output", "cons", "hour","r","w"])
#CSVwrite("dsgedata.csv", df)

max_stars_repo_name: Hiroakiyusheng/Econometrics

max_issues_repo_name: Hiroakiyusheng/Econometrics

max_forks_repo_name: Hiroakiyusheng/Econometrics


text:
type ConfusionMatrix
    classes::Vector
    matrix::Matrix{Int}
    accuracy::Float64
    kappa::Float64
end

function show(io::IO, cm::ConfusionMatrix)
    print(io, "Classes:  ")
    show(io, cm.classes)
    print(io, "\nMatrix:   ")
    display(cm.matrix)
    print(io, "\nAccuracy: ")
    show(io, cm.accuracy)
    print(io, "\nKappa:    ")
    show(io, cm.kappa)
end

function _hist_add!{T}(counts::Dict{T,Int}, labels::Vector{T}, region::Range1{Int})
    for i in region
        lbl = labels[i]
        counts[lbl] = get(counts, lbl, 0) + 1
    end
    return counts
end

function _hist_sub!{T}(counts::Dict{T,Int}, labels::Vector{T}, region::Range1{Int})
    for i in region
        lbl = labels[i]
        counts[lbl] -= 1
    end
    return counts
end

function _hist_shift!{T}(counts_from::Dict{T,Int}, counts_to::Dict{T,Int}, labels::Vector{T}, region::Range1{Int})
    for i in region
        lbl = labels[i]
        counts_from[lbl] -= 1
        counts_to[lbl] = get(counts_to, lbl, 0) + 1
    end
    return nothing
end

_hist{T}(labels::Vector{T}, region::Range1{Int} = 1:endof(labels)) =
    _hist_add!(Dict{T,Int}(), labels, region)

function _set_entropy{T}(counts::Dict{T,Int}, N::Int)
    entropy = 0.0
    for v in values(counts)
        if v > 0
            entropy += v * log(v)
        end
    end
    entropy /= -N
    entropy += log(N)
    return entropy
end

_set_entropy(labels::Vector) = _set_entropy(_hist(labels), length(labels))

function _info_gain{T}(N1::Int, counts1::Dict{T,Int}, N2::Int, counts2::Dict{T,Int})
    N = N1 + N2
    H = - N1/N * _set_entropy(counts1, N1) - N2/N * _set_entropy(counts2, N2)
    return H
end

function _neg_z1_loss{T<:Real}(labels::Vector, weights::Vector{T})
    missmatches = labels .!= majority_vote(labels)
    loss = sum(weights[missmatches])
    return -loss
end

function _weighted_error{T<:Real}(actual::Vector, predicted::Vector, weights::Vector{T})
    mismatches = actual .!= predicted
    err = sum(weights[mismatches]) / sum(weights)
    return err
end

function _mse_loss{T<:Float64, U<:Real}(labels::Vector{T}, features::Vector{U}, thresh)
    s_l = s_r = s2_l = s2_r = 0.0
    nl = nr = 0
    @inbounds for i in 1:length(labels)
      l = labels[i]
      if features[i] < thresh
        s_l += l
        s2_l += l*l
        nl += 1
      else
        s_r += l
        s2_r += l*l
        nr += 1
      end
    end
    loss = s2_l - s_l^2/nl + s2_r - s_r^2/nr
    return -loss
end

function majority_vote(labels::Vector)
    if length(labels) == 0
        return nothing
    end
    counts = _hist(labels)
    top_vote = labels[1]
    top_count = -1
    for (k,v) in counts
        if v > top_count
            top_vote = k
            top_count = v
        end
    end
    return top_vote
end

### Classification ###

function confusion_matrix(actual::Vector, predicted::Vector)
    @assert length(actual) == length(predicted)
    N = length(actual)
    _actual = zeros(Int,N)
    _predicted = zeros(Int,N)
    classes = sort(unique([actual; predicted]))
    N = length(classes)
    for i in 1:N
        _actual[actual .== classes[i]] = i
        _predicted[predicted .== classes[i]] = i
    end
    CM = zeros(Int,N,N)
    for i in zip(_actual, _predicted)
        CM[i[1],i[2]] += 1
    end
    accuracy = trace(CM) / sum(CM)
    prob_chance = (sum(CM,1) * sum(CM,2))[1] / sum(CM)^2
    kappa = (accuracy - prob_chance) / (1.0 - prob_chance)
    return ConfusionMatrix(classes, CM, accuracy, kappa)
end

function _nfoldCV(classifier::Symbol, labels, features, args...)
    nfolds = args[end]
    if nfolds < 2
        return nothing
    end
    if classifier == :tree
        pruning_purity = args[1]
    elseif classifier == :forest
        nsubfeatures = args[1]
        ntrees = args[2]
        partialsampling = args[3]
    elseif classifier == :stumps
        niterations = args[1]
    end
    N = length(labels)
    ntest = _int(floor(N / nfolds))
    inds = randperm(N)
    accuracy = zeros(nfolds)
    for i in 1:nfolds
        test_inds = falses(N)
        test_inds[(i - 1) * ntest + 1 : i * ntest] = true
        train_inds = !test_inds
        test_features = features[inds[test_inds],:]
        test_labels = labels[inds[test_inds]]
        train_features = features[inds[train_inds],:]
        train_labels = labels[inds[train_inds]]
        if classifier == :tree
            model = build_tree(train_labels, train_features, 0)
            if pruning_purity < 1.0
                model = prune_tree(model, pruning_purity)
            end
            predictions = apply_tree(model, test_features)
        elseif classifier == :forest
            model = build_forest(train_labels, train_features, nsubfeatures, ntrees, partialsampling)
            predictions = apply_forest(model, test_features)
        elseif classifier == :stumps
            model, coeffs = build_adaboost_stumps(train_labels, train_features, niterations)
            predictions = apply_adaboost_stumps(model, coeffs, test_features)
        end
        cm = confusion_matrix(test_labels, predictions)
        accuracy[i] = cm.accuracy
        println("\nFold ", i)
        println(cm)
    end
    println("\nMean Accuracy: ", mean(accuracy))
    return accuracy
end

nfoldCV_tree(labels::Vector, features::Matrix, pruning_purity::Real, nfolds::Integer)                                           = _nfoldCV(:tree, labels, features, pruning_purity, nfolds)
nfoldCV_forest(labels::Vector, features::Matrix, nsubfeatures::Integer, ntrees::Integer, nfolds::Integer, partialsampling=0.7)  = _nfoldCV(:forest, labels, features, nsubfeatures, ntrees, partialsampling, nfolds)
nfoldCV_stumps(labels::Vector, features::Matrix, niterations::Integer, nfolds::Integer)                                         = _nfoldCV(:stumps, labels, features, niterations, nfolds)

### Regression ###

function mean_squared_error(actual, predicted)
    @assert length(actual) == length(predicted)
    return mean((actual - predicted).^2)
end

function R2(actual, predicted)
    @assert length(actual) == length(predicted)
    ss_residual = sum((actual - predicted).^2)
    ss_total = sum((actual .- mean(actual)).^2)
    return 1.0 - ss_residual/ss_total
end

function _nfoldCV{T<:Float64, U<:Real}(regressor::Symbol, labels::Vector{T}, features::Matrix{U}, args...)
    nfolds = args[end]
    if nfolds < 2
        return nothing
    end
    if regressor == :tree
        maxlabels = args[1]
    elseif regressor == :forest
        nsubfeatures = args[1]
        ntrees = args[2]
        maxlabels = args[3]
        partialsampling = args[4]
    end
    N = length(labels)
    ntest = _int(floor(N / nfolds))
    inds = randperm(N)
    R2s = zeros(nfolds)
    for i in 1:nfolds
        test_inds = falses(N)
        test_inds[(i - 1) * ntest + 1 : i * ntest] = true
        train_inds = !test_inds
        test_features = features[inds[test_inds],:]
        test_labels = labels[inds[test_inds]]
        train_features = features[inds[train_inds],:]
        train_labels = labels[inds[train_inds]]
        if regressor == :tree
            model = build_tree(train_labels, train_features, maxlabels, 0)
            predictions = apply_tree(model, test_features)
        elseif regressor == :forest
            model = build_forest(train_labels, train_features, nsubfeatures, ntrees, maxlabels, partialsampling)
            predictions = apply_forest(model, test_features)
        end
        err = mean_squared_error(test_labels, predictions)
        corr = cor(test_labels, predictions)
        r2 = R2(test_labels, predictions)
        R2s[i] = r2
        println("\nFold ", i)
        println("Mean Squared Error:     ", err)
        println("Correlation Coeff:      ", corr)
        println("Coeff of Determination: ", r2)
    end
    println("\nMean Coeff of Determination: ", mean(R2s))
    return R2s
end

nfoldCV_tree{T<:Float64, U<:Real}(labels::Vector{T}, features::Matrix{U}, nfolds::Integer, maxlabels::Integer=5)      = _nfoldCV(:tree, labels, features, maxlabels, nfolds)
nfoldCV_forest{T<:Float64, U<:Real}(labels::Vector{T}, features::Matrix{U}, nsubfeatures::Integer, ntrees::Integer, nfolds::Integer, maxlabels::Integer=5, partialsampling=0.7)  = _nfoldCV(:forest, labels, features, nsubfeatures, ntrees, maxlabels, partialsampling, nfolds)


text:
############################################################################################
"""
$(TYPEDEF)
Holds tuning information for number of chains in comparison to data.

# Fields
$(TYPEDFIELDS)
"""
mutable struct ChainsTune
    "Proposed coverage of number of chains/number of data points."
    coverage::Float64
    "Threshold for resampling, between 0.0 and 1.0."
    threshold::Float64
    "Number of chains."
    Nchains::Int64
    "Number of data points."
    Ndata::Int64
    function ChainsTune(
        coverage::Float64,
        threshold::Float64,
        Nchains::Int64,
        Ndata::Int64
    )
        ArgCheck.@argcheck coverage > 0.0 "Coverage needs to be positive"
        ArgCheck.@argcheck Nchains > 0 "Nchains needs to be positive"
        ArgCheck.@argcheck Ndata > 0 "Ndata needs to be positive"
        ArgCheck.@argcheck threshold >= 0.0 "Threshold needs to be positive"
        return new(coverage, threshold, Nchains, Ndata)
    end
end

############################################################################################
function update!(ptune::ChainsTune, Ndata::Integer)
    ## Check if data size has changed
    update_Ndata = ptune.Ndata != Ndata ? UpdateTrue() : UpdateFalse()
    if update_Ndata isa UpdateTrue
        ptune.Ndata = Ndata
    end
    ## Check if chains size has changed
    Nchainsᵖ = Int64(floor(ptune.coverage * Ndata))
    #!NOTE: Update Nchains if coverage falls below data size.
    update_Nchains = ptune.Nchains != Nchainsᵖ ? UpdateTrue() : UpdateFalse()
    if update_Nchains isa UpdateTrue
        ptune.Nchains = Nchainsᵖ
    end
    return update_Nchains, update_Ndata
end

############################################################################################
#export
export ChainsTune


text:
include("test_blob.jl")
include("test_mesh_create_rot_sym.jl")
include("test_mesh.jl")
include("test_swept_mesh.jl")


text:
###############################################################################
#
# Abstract format type (extended from GriddingMachine.jl)
#
###############################################################################
"""
    abstract type AbstractFormat

Hierachy of AbstractFormat
- [`FormatTIFF`](@ref)
- [`FormatNC`](@ref)
"""
abstract type AbstractFormat end

"""
    struct FormatNC
"""
struct FormatNC <: AbstractFormat end

"""
    struct FormatTIFF
"""
struct FormatTIFF <: AbstractFormat end


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 (either the full ARN or the truncated
         resource name: for example, mesh/default/virtualNode/simpleapp) as the
            APPMESH_VIRTUAL_NODE_NAME 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.

            If you require your Envoy stats or tracing to use a different name, you can override
            the node.cluster value that is set by
               APPMESH_VIRTUAL_NODE_NAME with the
               APPMESH_VIRTUAL_NODE_CLUSTER environment variable.

         For more information about virtual nodes, see Virtual nodes.

# 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)


text:
# ps3000setpulsewidthqualifier.jl

export ps3000setpulsewidthqualifier, PWType, PWQConditions

immutable PWQConditions
  a :: Int16
  b :: Int16
  c :: Int16
  d :: Int16
  ext :: Int16
end

baremodule PWType
  const NONE = 0x0000
  const LESS_THAN = 0x0001
  const GREATER_THAN = 0x0002
  const IN_RANGE = 0x0003
  const OUT_OF_RANGE = 0x0004
end

# use PS3000TriggerState for a,b,c,d,ext
#=
CONDITION_DONT_CARE (0)
CONDITION_TRUE (1)
CONDITION_FALSE (2)
=#

function ps3000setpulsewidthqualifier(handle :: Int16,
                                      conditions :: PWQConditions,
                                      direction,
                                      lower,
                                      upper,
                                      pwtype)
  nconditions = 1
  ps_status = ccall((:ps3000SetPulseWidthQualifier, ps3000driver), Int16,
    (Int16, Ref{PWQConditions}, Int16, Int16, UInt32, UInt32, Int16),
    handle, Ref{PWQConditions}(conditions), nconditions,
    direction, lower, upper, pwtype)
  if ps_status == 0
    error("ps3000 Error: one of the parameters is out of range")
  end
  return nothing
end

function ps3000setpulsewidthqualifier(handle :: Int16)
  nconditions = 0
  direction = 0
  lower = 0
  upper = 0
  pwtype = 0
  ps_status = ccall((:ps3000SetPulseWidthQualifier, ps3000driver), Int16,
    (Int16, Ptr{Void}, Int16, Int16, UInt32, UInt32, Int16),
    handle, Ptr{Void}(C_NULL), nconditions,
    direction, lower, upper, pwtype)
  if ps_status == 0
    error("ps3000 Error: one of the parameters is out of range")
  end
  return nothing
end


text:
# This file holds the process that controls access to the SQLite database.

@resumable function dbCommitProcess( sim::Simulation, toTime::Float64,
    mpSim::ManpowerSimulation )

    while now( sim ) + mpSim.commitFrequency < toTime
        @yield timeout( sim, mpSim.commitFrequency )
        SQLite.execute!( mpSim.simDB, "COMMIT" )
        # println( "DB commit executed at $(now( sim ))" )
        SQLite.execute!( mpSim.simDB, "BEGIN TRANSACTION" )
    end  # while now( sim ) + mpSim.commitFrequency < toTime

end  # dbCommitProcess( sim, toTime, mpSim )