text:
export spinsph_mode
"""
    idx = spinsph_mode(l::Integer, m::Integer, s::Integer)
    idx::CartesianIndex{2}

Calculate the Cartesian index `idx` for the `l`,`m` mode for spin
weight `s`. This index can be used to access the coefficients, i.e.
the result of [`spinsph_transform`](@ref) or the input to
[`spinsph_evaluate`](@ref).

Coefficients are stored in a two-dimensional array. Not all array
elements are used. See [this
page](https://mikaelslevinsky.github.io/FastTransforms/transforms.html),
section "spinsph2fourier", for details.

See also: [`spinsph_transform!`](@ref), [`spinsph_transform`](@ref),
[`spinsph_evaluate!`](@ref), [`spinsph_evaluate`](@ref)
"""
function spinsph_mode(s::Int, l::Int, m::Int)
    @assert l ≥ abs(s)
    @assert abs(m) ≤ l
    return CartesianIndex(l - max(abs(s), abs(m)) + 1, 2 * abs(m) + (m ≥ 0))
end
function spinsph_mode(s::Integer, l::Integer, m::Integer)
    return spinsph_mode(Int(s), Int(l), Int(m))
end

################################################################################

function coeff_complex2real(C::AbstractArray{Complex{Float64},2}, s::Int)
    @assert s == 0
    C′ = Array{Float64}(undef, size(C))
    C′[:, 1] = real.(C[:, 1])
    for col in 2:2:size(C′, 2), row in 1:size(C′, 1)
        avg = (C[row, col] + conj(C[row, col + 1])) / sqrt(2)
        C′[row, col] = imag(avg)
        C′[row, col + 1] = real(avg)
    end
    return C′
end

function coeff_real2complex(C::AbstractArray{Float64,2}, s::Int)
    @assert s == 0
    C′ = Array{Complex{Float64}}(undef, size(C))
    C′[:, 1] = C[:, 1]
    for col in 2:2:size(C, 2), row in 1:size(C, 1)
        val = Complex{Float64}(C[row, col + 1], C[row, col]) / sqrt(2)
        C′[row, col] = val
        C′[row, col + 1] = conj(val)
    end
    return C′
end

function coeff_complex2vector(C::AbstractArray{Complex{Float64},2}, s::Int)
    @assert abs(s) == 1
    C′ = Array{SVector{2,Float64}}(undef, size(C))

    c2a(c) = SVector(real(c), imag(c))
    for col in 1:size(C′, 2), row in 1:size(C′, 1)
        c = C[row, col]
        if col == 1
            @assert abs(imag(c)) ≤ sqrt(eps())
            c = Complex(real(c), 0)
        end
        C′[row, col] = c2a(c)
    end

    return C′
end

function coeff_vector2complex(C::AbstractArray{SVector{2,Float64},2}, s::Int)
    @assert abs(s) == 1
    C′ = Array{Complex{Float64}}(undef, size(C))

    a2c(a) = Complex(a...)
    for col in 1:size(C′, 2), row in 1:size(C′, 1)
        a = C[row, col]
        if col == 1
            @assert abs(a[2]) ≤ sqrt(eps())
            a = SVector(a[1], 0)
        end
        C′[row, col] = a2c(a)
    end

    return C′
end

################################################################################

export spinsph_transform!
"""
    spinsph_transform!(F::Array{Complex{Float64},2}, s::Int)

Calculate the spin spherical harmonic transformation with spin weight
`s`. This is an in-place transform, i.e. the array `F` will be
overwritten by the coefficients. Use [`spinsph_transform`](@ref) for a
non-mutating function.

Use [`sph_points`](@ref) to caluclate the location of the points on
the sphere for the input array `F`.

Use [`spinsph_mode`](@ref) to calculate the location in the output
coefficient array for a particular `l`,`m` mode with spin weight `s`.

See also: [`spinsph_transform`](@ref), [`spinsph_evaluate!`](@ref),
[`sph_points`](@ref), [`spinsph_mode`](@ref)
"""
function spinsph_transform!(F::Array{Complex{Float64},2}, s::Int)
    N, M = size(F)
    @assert M > 0 && N > 0
    @assert M == 2 * N - 1
    P = plan_spinsph2fourier(F, s)
    PA = plan_spinsph_analysis(F, s)
    C = F
    lmul!(PA, C)
    ldiv!(P, C)
    return C
end

export spinsph_transform
"""
    C = spinsph_transform(F::AbstractArray{Complex{Float64},2}, s::Int)
    C::Array{Complex{Float64},2}

Calculate the spin spherical harmonic transformation with spin weight
`s`. You can use [`spinsph_transform!`](@ref) for more efficient a
mutating function that overwrites its argument `F`.

Use [`sph_points`](@ref) to caluclate the location of the points on
the sphere for the input array `F`.

Use [`spinsph_mode`](@ref) to calculate the location in the output
coefficient array for a particular `l`,`m` mode with spin weight `s`.

See also: [`spinsph_transform!`](@ref), [`spinsph_evaluate`](@ref),
[`sph_points`](@ref), [`spinsph_mode`](@ref)
"""
function spinsph_transform(F::AbstractArray{Complex{Float64},2}, s::Int)
    return spinsph_transform!(Array(F), s)
end
function spinsph_transform(F::AbstractArray{Float64,2}, s::Int)
    F′ = Array{Complex{Float64}}(F)
    C′ = spinsph_transform(F′, s)
    C = coeff_complex2real(C′, s)
    return C
end
function spinsph_transform(F::AbstractArray{SVector{2,Float64},2}, s::Int)
    a2c(a) = Complex(a...)
    F′ = a2c.(F)
    C′ = spinsph_transform(F′, s)
    C = coeff_complex2vector(C′, s)
    return C
end

################################################################################

export spinsph_evaluate!
"""
    spinsph_evaluate!(C::Array{Complex{Float64},2}, s::Int)

Evaluate the spin spherical harmonic transformation with spin weight
`s` on points on the sphere. This is an in-place transform, i.e. the
array `C` will be overwritten by the point values. Use
[`spinsph_evaluate`](@ref) for a non-mutating function.

Use [`spinsph_mode`](@ref) to calculate the location in the input
coefficient array for a particular `l`,`m` mode with spin weight `s`.

Use [`sph_points`](@ref) to caluclate the location of the points on the
sphere in the output array `F`.

See also: [`spinsph_evaluate`](@ref), [`spinsph_transform!`](@ref),
[`spinsph_mode`](@ref), [`sph_points`](@ref)
"""
function spinsph_evaluate!(C::Array{Complex{Float64},2}, s::Int)
    N, M = size(C)
    @assert M > 0 && N > 0
    @assert M == 2 * N - 1
    P = plan_spinsph2fourier(C, s)
    PS = plan_spinsph_synthesis(C, s)
    F = C
    lmul!(P, F)
    lmul!(PS, F)
    return F
end

export spinsph_evaluate
"""
    F = spinsph_evaluate(C::AbstractArray{Complex{Float64},2}, s::Int)
    F::Array{Complex{Float64},2}

Evaluate the spin spherical harmonic transformation with spin weight
`s` on points on the sphere. You can use [`spinsph_evaluate!`](@ref)
for more efficient a mutating function that overwrites its argument
`C`.

Use [`spinsph_mode`](@ref) to calculate the location in the input
coefficient array for a particular `l`,`m` mode with spin weight `s`.

Use [`sph_points`](@ref) to caluclate the location of the points on the
sphere in the output array `F`.

See also: [`spinsph_evaluate!`](@ref), [`spinsph_transform`](@ref),
[`spinsph_mode`](@ref), [`sph_points`](@ref)
"""
function spinsph_evaluate(C::AbstractArray{Complex{Float64},2}, s::Int)
    return spinsph_evaluate!(Array(C), s)
end
function spinsph_evaluate(C::AbstractArray{Float64,2}, s::Int)
    C′ = coeff_real2complex(C, s)
    F′ = spinsph_evaluate(C′, s)
    F = real.(F′)
    return F
end
function spinsph_evaluate(C::AbstractArray{SVector{2,Float64},2}, s::Int)
    # This function might be correct for other s as well, but I didn't
    # check
    @assert abs(s) == 1
    C′ = map(s -> Complex(s[1], s[2]), C)
    F′ = spinsph_evaluate(C′, s)
    F = map(c -> SVector(real(c), imag(c)), F′)
    return F::Array{SVector{2,Float64},2}
end

################################################################################

export spinsph_eth
"""
    ðC = spinsph_eth(C::AbstractArray{Complex{Float64},2}, s::Int)
    ðC::Array{Complex{Float64},2}

Apply the differential operator ð ("eth") to the coefficients `C`.
This raises the spin weight `s` by 1. For a real function of spin
weight 0, this is equivalent to calculating the gradient.

This function is the converse of [`spinsph_ethbar`](@ref), which is a
derivative operator lowering the spin weight.

Use [`spinsph_mode`](@ref) to calculate the location in the output
coefficient array for a particular `l`,`m` mode with spin weight `s`.

See also: [`spinsph_ethbar`](@ref), [`spinsph_mode`](@ref)
"""
function spinsph_eth(C::AbstractArray{Complex{Float64},2}, s::Int)
    N, M = size(C)
    @assert M > 0 && N > 0
    @assert M == 2 * N - 1
    lmax = N - 1
    mmax = M ÷ 2

    ðC = zeros(Complex{Float64}, size(C))
    for l in max(abs(s + 1), abs(s)):(lmax + mmax), m in (-l):l
        if l - lmax ≤ abs(m) ≤ mmax
            ðC[spinsph_mode(s + 1, l, m)] = sqrt((l - s) * (l + s + 1)) *
                                            C[spinsph_mode(s, l, m)]
        end
    end

    return ðC
end
function spinsph_eth(C::AbstractArray{Float64,2}, s::Int)
    C′ = coeff_real2complex(C, s)
    ðC′ = spinsph_eth(C′, s)
    ðC = coeff_complex2vector(ðC′, s + 1)

    for col in 1:size(ðC, 2)
        m = col == 1 ? 0 : (col % 2 == 0 ? -1 : 1) * (col ÷ 2)
        α = ifelse(m ≥ s, 1, -1)
        ðC[:, col] .*= α
    end

    return ðC
end
function spinsph_eth(C::AbstractArray{SVector{2,Float64},2}, s::Int)
    C′ = coeff_vector2complex(C, s)

    for col in 1:size(C′, 2)
        m = col == 1 ? 0 : (col % 2 == 0 ? -1 : 1) * (col ÷ 2)
        α = ifelse(m > s + 1, 1, -1)
        C′[:, col] .*= α
    end

    ðC′ = spinsph_eth(C′, s)
    ðC = coeff_complex2real(ðC′, s + 1)

    return ðC
end

################################################################################

export spinsph_ethbar
"""
    ðC = spinsph_ethbar(C::AbstractArray{Complex{Float64},2}, s::Int)
    ðC::Array{Complex{Float64},2}

Apply the differential operator ð̄ ("eth-bar") to the coefficients `C`.
This lowers the spin weight `s` by 1. For a function of spin weight 1,
this is equivalent to calculating the divergence.

This function is the converse of [`spinsph_eth`](@ref), which is a
derivative operator raising the spin weight.

Use [`spinsph_mode`](@ref) to calculate the location in the output
coefficient array for a particular `l`,`m` mode with spin weight `s`.

See also: [`spinsph_eth`](@ref), [`spinsph_mode`](@ref)
"""
function spinsph_ethbar(C::AbstractArray{Complex{Float64},2}, s::Int)
    N, M = size(C)
    @assert M > 0 && N > 0
    @assert M == 2 * N - 1
    lmax = N - 1
    mmax = M ÷ 2

    ð̄C = zeros(Complex{Float64}, size(C))
    for l in max(abs(s - 1), abs(s)):(lmax + mmax), m in (-l):l
        if l - lmax ≤ abs(m) ≤ mmax
            ð̄C[spinsph_mode(s - 1, l, m)] = -sqrt((l + s) * (l - s + 1)) *
                                             C[spinsph_mode(s, l, m)]
        end
    end

    return ð̄C
end
function spinsph_ethbar(C::AbstractArray{Float64,2}, s::Int)
    C′ = coeff_real2complex(C, s)
    ðC′ = spinsph_ethbar(C′, s)
    ðC = coeff_complex2vector(ðC′, s - 1)

    for col in 1:size(ðC, 2)
        m = col == 1 ? 0 : (col % 2 == 0 ? -1 : 1) * (col ÷ 2)
        α = ifelse(m > s, 1, -1)
        ðC[:, col] .*= α
    end

    return ðC
end
function spinsph_ethbar(C::AbstractArray{SVector{2,Float64},2}, s::Int)
    C′ = coeff_vector2complex(C, s)

    for col in 1:size(C′, 2)
        m = col == 1 ? 0 : (col % 2 == 0 ? -1 : 1) * (col ÷ 2)
        α = ifelse(m ≥ s - 1, 1, -1)
        C′[:, col] .*= α
    end

    ðC′ = spinsph_ethbar(C′, s)
    ðC = coeff_complex2real(ðC′, s - 1)

    return ðC
end


text:
#
# We need this constructor to route around the FixedSizeArray `call` and
# so Simplex(Pt, Pt...) etc works. Hopefully these ambiguities will be fixed in
# forthcoming Julia versions.
function (::Type{S})(sv::StaticVector) where S <: Simplex
    Simplex{1, typeof(sv)}((sv,))
end

@inline function Simplex{S, T}(x) where {S, T}
    Simplex{S, T}(ntuple(i-> T(x), Val(S)))
end
@inline function Simplex{S}(x::T) where {S, T}
    Simplex{S, T}(ntuple(i-> x, Val(S)))
end
@inline function Simplex{1, T}(x::T) where T
    Simplex{1, T}((x,))
end
@inline Simplex(x::NTuple{S}) where {S} = Simplex{S}(x)
@inline function Simplex{S}(x::T) where {S, T <: Tuple}
    Simplex{S, StaticArrays.promote_tuple_eltype(T)}(x)
end
Simplex{S, T}(f::FlexibleSimplex) where {S, T} = Simplex{S, T}(tuple(vertices(f)...))
Simplex{S}(f::FlexibleSimplex) where {S} = Simplex{S, eltype(f)}(f)
Simplex(f::FlexibleSimplex) = Simplex(tuple(vertices(f)...))

Base.@pure Base.size(::Union{Simplex{S}, Type{Simplex{S}}}) where {S} = (S, )
Base.@pure Base.size(::Type{Simplex{S, T}}) where {S,T} = (S,)

Base.@propagate_inbounds function Base.getindex(v::Simplex, i::Int)
    v.data[i]
end
@inline Base.Tuple(v::Simplex) = v.data
@inline Base.convert(::Type{Simplex{S, T}}, x::NTuple{S, T}) where {S, T} = Simplex{S, T}(x)
# @inline Base.convert{SV <: Simplex}(::Type{SV}, x::StaticVector) = SV(x)
@inline function Base.convert(::Type{Simplex{S, T}}, x::Tuple) where {S, T}
    Simplex{S, T}(convert(NTuple{S, T}, x))
end
Base.convert(::Type{S}, f::AFG) where {S <: Simplex} = S(f)
# StaticArrays.similar_type{SV <: Simplex}(::Union{SV, Type{SV}}) = Simplex
# function StaticArrays.similar_type{SV <: Simplex, T}(::Union{SV, Type{SV}}, ::Type{T})
#     Simplex{length(SV), T}
# end
# function StaticArrays.similar_type{SV <: Simplex}(::Union{SV, Type{SV}}, s::Tuple{Int})
#     Simplex{s[1], eltype(SV)}
# end
function StaticArrays.similar_type(::Union{Simplex, Type{Simplex}}, ::Type{T}, s::Size{S}) where {T, S}
    Simplex{S[1], T}
end

# (::Type{S}){S <: Simplex}(fs::FlexibleSimplex) = convert(S, fs)
#
# # FSA doesn't handle symbols for length 1 well.
# function (::Type{T}){T <: Simplex}(f::Symbol)
#     Simplex{1 ,Symbol}((f,))
# end

"""
volume_unnormalized(s::Simplex)

Return volume of s, normalized such that the simplex spanned
by the origin and unit vectors has volume 1.
"""
function volume_unnormalized(s::Simplex)
    es = edgespan(s); √(det(es'*es))
end

"""
volume(s::Simplex)

Return the volume of a geometric object.
"""
volume(s::Simplex) = volume_unnormalized(s) / factorial(nvertices(s)-1)

"""
w = weights(pt, s::Simplex)

If pt is a point inside s, w is such that
sum(w .* vertices(s)) = pt.
This is still true, if pt just lies inside the affine subspace spanned by s.
For general point pt, we only have
sum(w .* vertices(s)) = projection of pt onto affine subspace spanned by s.
"""
function weights(pt, s::Simplex)
    wp = pinvli(edgespan(s)) * (pt - translation(s))
    pushfirst(wp, 1-sum(wp))
end

translation(s::Simplex) = first(vertices(s))

@generated function edgespan(s::Simplex{m, T}) where {m, T}
    M = m - 1; N = length(T)
    ET = eltype(T)
    init = quote
        vert = vertices(s)
        v1 = vert[1]
    end
    tupl = Expr(:tuple)
    for i = 2:m
        sym = Symbol("diff$i")
        push!(init.args, :($sym = vert[$i]-v1))
        append!(tupl.args, (:($sym[$j]) for j = 1:N))
    end
    quote
        $init
        return Mat{$N, $M, $ET, $(M*N)}($tupl)
    end
end

"""
simplex_face(s::Simplex, i::Int)::Simplex

Return the face opposite to ith vertex of simplex.
"""
simplex_face(s::Simplex, i::Int) = Simplex(deleteat(vertices(s), i))

"""
proj_sqdist{T}(pt::T, s::LineSegment{T}, best_sqd=eltype(T)(Inf))
"""
function proj_sqdist(pt::T, s::LineSegment{T}, best_sqd=Inf) where T
    v0, v1 = vertices(s)
    pt = pt - v0
    v = v1 - v0
    θ = clamp(dot(v,pt)/sqnorm(v), zero(eltype(T)), one(eltype(T)))
    pt_proj = θ*v
    best_sqd = min(sqdist(pt, pt_proj), best_sqd)
    return pt_proj + v0, best_sqd
end

"""
pt_proj, sqd = proj_sqdist{nv,T}(pt::T, s::Simplex{nv,T}, best_sqd=eltype(T)(Inf))

# parameters

* pt, s: A point and a simplex, of which we want to know the (minimal) square distance.
* best_sqd: A bound on the distance. If the actual distance is greater then this,
search for the closest point is canceled asap.

# Return

* pt_proj is a point inside s, with minimal distance to pt. If the actual square
distance is greater then best_sqd, the behaviour of pt_proj is not defined.
* sqd is the square of the euclidean distance between pt, s. If the actual square
distance is greater then best_sqd is returned instead.

"""
function proj_sqdist(pt::T, s::Simplex{nv,T}, best_sqd=Inf) where {nv,T}
    w = weights(pt, s)
    best_proj = Vec(vertexmat(s) * w)
    # at this point best_proj lies in the subspace spanned by s,
    # but not necessarily inside s
    sqd = sqdist(pt, best_proj)
    if sqd >= best_sqd  # pt is far away even from the subspace spanned by s
        return best_proj, best_sqd
    elseif any(w .< 0)  # pt is closest to point inside a face of s
        @inbounds for i in 1:length(w)
            if w[i] < 0
                proj, sqd = proj_sqdist(pt, simplex_face(s, i), best_sqd)
                if sqd < best_sqd
                    best_sqd = sqd
                    best_proj = proj
                end
            end
        end
        return best_proj, best_sqd
    else # proj lies in the interiour of s
        return best_proj, sqd
    end
end

sqdist(pt, s, best=Inf) = proj_sqdist(pt, s, best)[2]

"""
proj_sqdist(p::Vec, q::Vec, best_sqd=eltype(p)(Inf))
"""
@inline function proj_sqdist(p::Vec, q::Vec, best_sqd=Inf)
    q, min(best_sqd, sqnorm(p-q))
end
"""
proj_sqdist{T}(pt::T, s::Simplex{1, T}, best_sqd=eltype(T)(Inf))
"""
@inline function proj_sqdist(pt::T, s::Simplex{1, T}, best_sqd=Inf) where T
    proj_sqdist(pt, translation(s), best_sqd)
end

"""
contains(s::Simplex, pt; atol=0., rtol=defaulrtol(eltype(pt)))

Check if a point is contained inside a Simplex. If the intrinsic dimension
of the simplex is smaller then the dimension of the surrounding space
(for example a triangle in 3d) one needs the atol, rtol parameters.
"""
function contains(s::Simplex, pt; atol=0., rtol=Base.rtoldefault(eltype(pt)))
    w = weights(pt, s)
    all(w .>= -atol) || return false  # projection lies outside of s
    pt_proj = vertexmat(s) * w
    return isapprox(pt_proj, pt, atol=atol, rtol=rtol)
end

ext: jl


text:
#libhts_detected = false
function detecthts()
    @osx_only info("You should compile libhts.dylab manually and set its location to HTSLIB.libhts")
    false
end
#@osx_only using Homebrew
using BinDeps
@BinDeps.setup
if !detecthts()

    # install zlib
    #zlib = library_dependency("zlib", aliases = ["libzlib","zlib1","libzlib.so"])
    #provides(Sources, Dict(URI("http://zlib.net/zlib-1.2.8.tar.gz") => zlib))

    # Build libhts

    @osx_only begin
        autoconf = library_dependency("autoconf", aliases=["autoconf"],runtime=false, os=:Darwin)
        #=
        if Pkg.installed("Homebrew") === nothing
            error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
        end
        provides( Homebrew.HB, "autoconf", autoconf, os = :Darwin )
        =#

        _prefix = joinpath(BinDeps.depsdir(autoconf),"usr")
        _srcdir = joinpath(BinDeps.depsdir(autoconf),"src")
        _autoconfdir = joinpath(_srcdir,"autoconf-2.68")
        #_bindir = joinpath(_prefix, "bin")
        _libdir = joinpath(_prefix, "lib")
        provides(BuildProcess,
                 (@build_steps begin
                  CreateDirectory(_srcdir)
                  CreateDirectory(_libdir)
                  @build_steps begin
                  ChangeDirectory(_srcdir)
                  `rm -rf autoconf`
                  `wget http://ftpmirror.gnu.org/autoconf/autoconf-2.68.tar.gz`
                  `tar xvf autoconf-2.68.tar.gz`
                  FileRule(joinpath(_libdir, "autoconf"), @build_steps begin
                           ChangeDirectory(_autoconfdir)
                           `./configure`
                           `make`
                           `cp bin/autoconf $_libdir`
                           `ls $_libdir`
                           end)
                  end
                 end), autoconf)

        @BinDeps.install Dict(:autoconf => :autoconf)
    end

    info("Congrats! Successfully build contoconf")
#=
    hts = library_dependency("hts", aliases=["libhts","libhts.so","libhts.dylib","libhts.dll"])#, runtime=true, os=:Unix)
    _prefix = joinpath(BinDeps.depsdir(hts),"usr")
    _srcdir = joinpath(BinDeps.depsdir(hts),"src")
    _htsdir = joinpath(_srcdir,"htslib-1.3")
    _libdir = joinpath(_prefix, "lib")
    provides(BuildProcess,
             (@build_steps begin
                #CreateDirectory(_srcdir)
                CreateDirectory(_libdir)
                @build_steps begin
                  ChangeDirectory(_srcdir)
                  `rm -rf htslib`
                  `wget https://github.com/samtools/htslib/releases/download/1.3/htslib-1.3.tar.bz2`
                  `tar xvf htslib-1.3.tar.bz2`
                   FileRule(joinpath(_libdir, "libhts.so"), @build_steps begin
                     ChangeDirectory(_htsdir)
                     @linux_only `autoconf`
                     @osx_only `../../bin/autoconf`
                     `./configure`
                     `make`
                     @linux_only `cp libhts.so $_libdir`
                     @osx_only `cp libhts.dylib $_libdir`
                     @windows_only `cp libhts.dll $_libdir`
                   end)
                end
             end), hts)

    info("install begins")
    @BinDeps.install Dict(:hts => :hts)
    =#
end


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

"""
    associate_file_system_aliases(aliases, file_system_id)
    associate_file_system_aliases(aliases, file_system_id, params::Dict{String,<:Any})

Use this action to associate one or more Domain Name Server (DNS) aliases with an existing
Amazon FSx for Windows File Server file system. A file system can have a maximum of 50 DNS
aliases associated with it at any one time. If you try to associate a DNS alias that is
already associated with the file system, FSx takes no action on that alias in the request.
For more information, see Working with DNS Aliases and Walkthrough 5: Using DNS aliases to
access your file system, including additional steps you must take to be able to access your
file system using a DNS alias. The system response shows the DNS aliases that Amazon FSx is
attempting to associate with the file system. Use the API operation to monitor the status
of the aliases Amazon FSx is associating with the file system.

# Arguments
- `aliases`: An array of one or more DNS alias names to associate with the file system. The
  alias name has to comply with the following formatting requirements:   Formatted as a
  fully-qualified domain name (FQDN),  hostname.domain , for example,
  accounting.corp.example.com.   Can contain alphanumeric characters and the hyphen (-).
  Cannot start or end with a hyphen.   Can start with a numeric.   For DNS alias names,
  Amazon FSx stores alphabetic characters as lowercase letters (a-z), regardless of how you
  specify them: as uppercase letters, lowercase letters, or the corresponding letters in
  escape codes.
- `file_system_id`: Specifies the file system with which you want to associate one or more
  DNS aliases.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
"""
function associate_file_system_aliases(
    Aliases, FileSystemId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "AssociateFileSystemAliases",
        Dict{String,Any}(
            "Aliases" => Aliases,
            "FileSystemId" => FileSystemId,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function associate_file_system_aliases(
    Aliases,
    FileSystemId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "AssociateFileSystemAliases",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "Aliases" => Aliases,
                    "FileSystemId" => FileSystemId,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    cancel_data_repository_task(task_id)
    cancel_data_repository_task(task_id, params::Dict{String,<:Any})

Cancels an existing Amazon FSx for Lustre data repository task if that task is in either
the PENDING or EXECUTING state. When you cancel a task, Amazon FSx does the following.
Any files that FSx has already exported are not reverted.   FSx continues to export any
files that are \"in-flight\" when the cancel operation is received.   FSx does not export
any files that have not yet been exported.

# Arguments
- `task_id`: Specifies the data repository task to cancel.

"""
function cancel_data_repository_task(
    TaskId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CancelDataRepositoryTask",
        Dict{String,Any}("TaskId" => TaskId);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function cancel_data_repository_task(
    TaskId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CancelDataRepositoryTask",
        Dict{String,Any}(mergewith(_merge, Dict{String,Any}("TaskId" => TaskId), params));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    copy_backup(source_backup_id)
    copy_backup(source_backup_id, params::Dict{String,<:Any})

Copies an existing backup within the same Amazon Web Services account to another Amazon Web
Services Region (cross-Region copy) or within the same Amazon Web Services Region
(in-Region copy). You can have up to five backup copy requests in progress to a single
destination Region per account. You can use cross-Region backup copies for cross-region
disaster recovery. You periodically take backups and copy them to another Region so that in
the event of a disaster in the primary Region, you can restore from backup and recover
availability quickly in the other Region. You can make cross-Region copies only within your
Amazon Web Services partition.  You can also use backup copies to clone your file data set
to another Region or within the same Region. You can use the SourceRegion parameter to
specify the Amazon Web Services Region from which the backup will be copied. For example,
if you make the call from the us-west-1 Region and want to copy a backup from the us-east-2
Region, you specify us-east-2 in the SourceRegion parameter to make a cross-Region copy. If
you don't specify a Region, the backup copy is created in the same Region where the request
is sent from (in-Region copy). For more information on creating backup copies, see  Copying
backups in the Amazon FSx for Windows User Guide and Copying backups in the Amazon FSx for
Lustre User Guide.

# Arguments
- `source_backup_id`: The ID of the source backup. Specifies the ID of the backup that is
  being copied.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"CopyTags"`: A boolean flag indicating whether tags from the source backup should be
  copied to the backup copy. This value defaults to false. If you set CopyTags to true and
  the source backup has existing tags, you can use the Tags parameter to create new tags,
  provided that the sum of the source backup tags and the new tags doesn't exceed 50. Both
  sets of tags are merged. If there are tag conflicts (for example, two tags with the same
  key but different values), the tags created with the Tags parameter take precedence.
- `"KmsKeyId"`:
- `"SourceRegion"`: The source Amazon Web Services Region of the backup. Specifies the
  Amazon Web Services Region from which the backup is being copied. The source and
  destination Regions must be in the same Amazon Web Services partition. If you don't specify
  a Region, it defaults to the Region where the request is sent from (in-Region copy).
- `"Tags"`:
"""
function copy_backup(SourceBackupId; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "CopyBackup",
        Dict{String,Any}(
            "SourceBackupId" => SourceBackupId, "ClientRequestToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function copy_backup(
    SourceBackupId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CopyBackup",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "SourceBackupId" => SourceBackupId,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_backup()
    create_backup(params::Dict{String,<:Any})

Creates a backup of an existing Amazon FSx for Windows File Server or Amazon FSx for Lustre
file system, or of an Amazon FSx for NetApp ONTAP volume. Creating regular backups is a
best practice, enabling you to restore a file system or volume from a backup if an issue
arises with the original file system or volume. For Amazon FSx for Lustre file systems, you
can create a backup only for file systems with the following configuration:   a Persistent
deployment type   is not linked to a data repository.   For more information about backups,
see the following:   For Amazon FSx for Lustre, see Working with FSx for Lustre backups.
For Amazon FSx for Windows, see Working with FSx for Windows backups.   For Amazon FSx for
NetApp ONTAP, see Working with FSx for NetApp ONTAP backups.   If a backup with the
specified client request token exists, and the parameters match, this operation returns the
description of the existing backup. If a backup specified client request token exists, and
the parameters don't match, this operation returns IncompatibleParameterError. If a backup
with the specified client request token doesn't exist, CreateBackup does the following:
Creates a new Amazon FSx backup with an assigned ID, and an initial lifecycle state of
CREATING.   Returns the description of the backup.   By using the idempotent operation, you
can retry a CreateBackup operation without the risk of creating an extra backup. This
approach can be useful when an initial call fails in a way that makes it unclear whether a
backup was created. If you use the same client request token and the initial call created a
backup, the operation returns a successful result because all the parameters are the same.
The CreateBackup operation returns while the backup's lifecycle state is still CREATING.
You can check the backup creation status by calling the DescribeBackups operation, which
returns the backup state along with other information.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`: (Optional) A string of up to 64 ASCII characters that Amazon FSx
  uses to ensure idempotent creation. This string is automatically filled on your behalf when
  you use the Command Line Interface (CLI) or an Amazon Web Services SDK.
- `"FileSystemId"`: The ID of the file system to back up.
- `"Tags"`: (Optional) The tags to apply to the backup at backup creation. The key value of
  the Name tag appears in the console as the backup name. If you have set CopyTagsToBackups
  to true, and you specify one or more tags using the CreateBackup action, no existing file
  system tags are copied from the file system to the backup.
- `"VolumeId"`: The ID of he FSx for NetApp ONTAP volume to back up.
"""
function create_backup(; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "CreateBackup",
        Dict{String,Any}("ClientRequestToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_backup(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CreateBackup",
        Dict{String,Any}(
            mergewith(
                _merge, Dict{String,Any}("ClientRequestToken" => string(uuid4())), params
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_data_repository_task(file_system_id, report, type)
    create_data_repository_task(file_system_id, report, type, params::Dict{String,<:Any})

Creates an Amazon FSx for Lustre data repository task. You use data repository tasks to
perform bulk operations between your Amazon FSx file system and its linked data repository.
An example of a data repository task is exporting any data and metadata changes, including
POSIX metadata, to files, directories, and symbolic links (symlinks) from your FSx file
system to its linked data repository. A CreateDataRepositoryTask operation will fail if a
data repository is not linked to the FSx file system. To learn more about data repository
tasks, see Data Repository Tasks. To learn more about linking a data repository to your
file system, see Linking your file system to an S3 bucket.

# Arguments
- `file_system_id`:
- `report`: Defines whether or not Amazon FSx provides a CompletionReport once the task has
  completed. A CompletionReport provides a detailed report on the files that Amazon FSx
  processed that meet the criteria specified by the Scope parameter. For more information,
  see Working with Task Completion Reports.
- `type`: Specifies the type of data repository task to create.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"Paths"`: (Optional) The path or paths on the Amazon FSx file system to use when the
  data repository task is processed. The default path is the file system root directory. The
  paths you provide need to be relative to the mount point of the file system. If the mount
  point is /mnt/fsx and /mnt/fsx/path1 is a directory or file on the file system you want to
  export, then the path to provide is path1. If a path that you provide isn't valid, the task
  fails.
- `"Tags"`:
"""
function create_data_repository_task(
    FileSystemId, Report, Type; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CreateDataRepositoryTask",
        Dict{String,Any}(
            "FileSystemId" => FileSystemId,
            "Report" => Report,
            "Type" => Type,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_data_repository_task(
    FileSystemId,
    Report,
    Type,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateDataRepositoryTask",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "FileSystemId" => FileSystemId,
                    "Report" => Report,
                    "Type" => Type,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_file_system(file_system_type, storage_capacity, subnet_ids)
    create_file_system(file_system_type, storage_capacity, subnet_ids, params::Dict{String,<:Any})

Creates a new, empty Amazon FSx file system. If a file system with the specified client
request token exists and the parameters match, CreateFileSystem returns the description of
the existing file system. If a file system specified client request token exists and the
parameters don't match, this call returns IncompatibleParameterError. If a file system with
the specified client request token doesn't exist, CreateFileSystem does the following:
Creates a new, empty Amazon FSx file system with an assigned ID, and an initial lifecycle
state of CREATING.   Returns the description of the file system.   This operation requires
a client request token in the request that Amazon FSx uses to ensure idempotent creation.
This means that calling the operation multiple times with the same client request token has
no effect. By using the idempotent operation, you can retry a CreateFileSystem operation
without the risk of creating an extra file system. This approach can be useful when an
initial call fails in a way that makes it unclear whether a file system was created.
Examples are if a transport level timeout occurred, or your connection was reset. If you
use the same client request token and the initial call created a file system, the client
receives success as long as the parameters are the same.  The CreateFileSystem call returns
while the file system's lifecycle state is still CREATING. You can check the file-system
creation status by calling the DescribeFileSystems operation, which returns the file system
state along with other information.

# Arguments
- `file_system_type`: The type of Amazon FSx file system to create. Valid values are
  WINDOWS, LUSTRE, and ONTAP.
- `storage_capacity`: Sets the storage capacity of the file system that you're creating.
  For Lustre file systems:   For SCRATCH_2 and PERSISTENT_1 SSD deployment types, valid
  values are 1200 GiB, 2400 GiB, and increments of 2400 GiB.   For PERSISTENT HDD file
  systems, valid values are increments of 6000 GiB for 12 MB/s/TiB file systems and
  increments of 1800 GiB for 40 MB/s/TiB file systems.   For SCRATCH_1 deployment type, valid
  values are 1200 GiB, 2400 GiB, and increments of 3600 GiB.   For Windows file systems:   If
  StorageType=SSD, valid values are 32 GiB - 65,536 GiB (64 TiB).   If StorageType=HDD, valid
  values are 2000 GiB - 65,536 GiB (64 TiB).   For ONTAP file systems:   Valid values are
  1024 GiB - 196,608 GiB (192 TiB).
- `subnet_ids`: Specifies the IDs of the subnets that the file system will be accessible
  from. For Windows and ONTAP MULTI_AZ_1 file system deployment types, provide exactly two
  subnet IDs, one for the preferred file server and one for the standby file server. You
  specify one of these subnets as the preferred subnet using the WindowsConfiguration >
  PreferredSubnetID or OntapConfiguration > PreferredSubnetID properties. For more
  information, see  Availability and durability: Single-AZ and Multi-AZ file systems in the
  Amazon FSx for Windows User Guide and  Availability and durability in the Amazon FSx for
  ONTAP User Guide. For Windows SINGLE_AZ_1 and SINGLE_AZ_2 file system deployment types and
  Lustre file systems, provide exactly one subnet ID. The file server is launched in that
  subnet's Availability Zone.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`: A string of up to 64 ASCII characters that Amazon FSx uses to
  ensure idempotent creation. This string is automatically filled on your behalf when you use
  the Command Line Interface (CLI) or an Amazon Web Services SDK.
- `"FileSystemTypeVersion"`: Sets the version of the Amazon FSx for Lustre file system
  you're creating. Valid values are 2.10 and 2.12.   Set the value to 2.10 to create a Lustre
  2.10 file system.   Set the value to 2.12 to create a Lustre 2.12 file system.   Default
  value is 2.10.
- `"KmsKeyId"`:
- `"LustreConfiguration"`:
- `"OntapConfiguration"`:
- `"SecurityGroupIds"`: A list of IDs specifying the security groups to apply to all
  network interfaces created for file system access. This list isn't returned in later
  requests to describe the file system.
- `"StorageType"`: Sets the storage type for the file system you're creating. Valid values
  are SSD and HDD.   Set to SSD to use solid state drive storage. SSD is supported on all
  Windows, Lustre, and ONTAP deployment types.   Set to HDD to use hard disk drive storage.
  HDD is supported on SINGLE_AZ_2 and MULTI_AZ_1 Windows file system deployment types, and on
  PERSISTENT Lustre file system deployment types.     Default value is SSD. For more
  information, see  Storage Type Options in the Amazon FSx for Windows User Guide and
  Multiple Storage Options in the Amazon FSx for Lustre User Guide.
- `"Tags"`: The tags to apply to the file system being created. The key value of the Name
  tag appears in the console as the file system name.
- `"WindowsConfiguration"`: The Microsoft Windows configuration for the file system being
  created.
"""
function create_file_system(
    FileSystemType,
    StorageCapacity,
    SubnetIds;
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateFileSystem",
        Dict{String,Any}(
            "FileSystemType" => FileSystemType,
            "StorageCapacity" => StorageCapacity,
            "SubnetIds" => SubnetIds,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_file_system(
    FileSystemType,
    StorageCapacity,
    SubnetIds,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateFileSystem",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "FileSystemType" => FileSystemType,
                    "StorageCapacity" => StorageCapacity,
                    "SubnetIds" => SubnetIds,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_file_system_from_backup(backup_id, subnet_ids)
    create_file_system_from_backup(backup_id, subnet_ids, params::Dict{String,<:Any})

Creates a new Amazon FSx for Lustre or Amazon FSx for Windows File Server file system from
an existing Amazon FSx backup. If a file system with the specified client request token
exists and the parameters match, this operation returns the description of the file system.
If a client request token specified by the file system exists and the parameters don't
match, this call returns IncompatibleParameterError. If a file system with the specified
client request token doesn't exist, this operation does the following:   Creates a new
Amazon FSx file system from backup with an assigned ID, and an initial lifecycle state of
CREATING.   Returns the description of the file system.   Parameters like Active Directory,
default share name, automatic backup, and backup settings default to the parameters of the
file system that was backed up, unless overridden. You can explicitly supply other
settings. By using the idempotent operation, you can retry a CreateFileSystemFromBackup
call without the risk of creating an extra file system. This approach can be useful when an
initial call fails in a way that makes it unclear whether a file system was created.
Examples are if a transport level timeout occurred, or your connection was reset. If you
use the same client request token and the initial call created a file system, the client
receives success as long as the parameters are the same.  The CreateFileSystemFromBackup
call returns while the file system's lifecycle state is still CREATING. You can check the
file-system creation status by calling the DescribeFileSystems operation, which returns the
file system state along with other information.

# Arguments
- `backup_id`:
- `subnet_ids`: Specifies the IDs of the subnets that the file system will be accessible
  from. For Windows MULTI_AZ_1 file system deployment types, provide exactly two subnet IDs,
  one for the preferred file server and one for the standby file server. You specify one of
  these subnets as the preferred subnet using the WindowsConfiguration > PreferredSubnetID
  property. For Windows SINGLE_AZ_1 and SINGLE_AZ_2 deployment types and Lustre file systems,
  provide exactly one subnet ID. The file server is launched in that subnet's Availability
  Zone.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`: A string of up to 64 ASCII characters that Amazon FSx uses to
  ensure idempotent creation. This string is automatically filled on your behalf when you use
  the Command Line Interface (CLI) or an Amazon Web Services SDK.
- `"FileSystemTypeVersion"`: Sets the version for the Amazon FSx for Lustre file system
  you're creating from a backup. Valid values are 2.10 and 2.12. You don't need to specify
  FileSystemTypeVersion because it will be applied using the backup's FileSystemTypeVersion
  setting. If you choose to specify FileSystemTypeVersion when creating from backup, the
  value must match the backup's FileSystemTypeVersion setting.
- `"KmsKeyId"`:
- `"LustreConfiguration"`:
- `"SecurityGroupIds"`: A list of IDs for the security groups that apply to the specified
  network interfaces created for file system access. These security groups apply to all
  network interfaces. This value isn't returned in later DescribeFileSystem requests.
- `"StorageType"`: Sets the storage type for the Windows file system you're creating from a
  backup. Valid values are SSD and HDD.   Set to SSD to use solid state drive storage.
  Supported on all Windows deployment types.   Set to HDD to use hard disk drive storage.
  Supported on SINGLE_AZ_2 and MULTI_AZ_1 Windows file system deployment types.     Default
  value is SSD.   HDD and SSD storage types have different minimum storage capacity
  requirements. A restored file system's storage capacity is tied to the file system that was
  backed up. You can create a file system that uses HDD storage from a backup of a file
  system that used SSD storage only if the original SSD file system had a storage capacity of
  at least 2000 GiB.
- `"Tags"`: The tags to be applied to the file system at file system creation. The key
  value of the Name tag appears in the console as the file system name.
- `"WindowsConfiguration"`: The configuration for this Microsoft Windows file system.
"""
function create_file_system_from_backup(
    BackupId, SubnetIds; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CreateFileSystemFromBackup",
        Dict{String,Any}(
            "BackupId" => BackupId,
            "SubnetIds" => SubnetIds,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_file_system_from_backup(
    BackupId,
    SubnetIds,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateFileSystemFromBackup",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "BackupId" => BackupId,
                    "SubnetIds" => SubnetIds,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_storage_virtual_machine(file_system_id, name)
    create_storage_virtual_machine(file_system_id, name, params::Dict{String,<:Any})

Creates a storage virtual machine (SVM) for an Amazon FSx for ONTAP file system.

# Arguments
- `file_system_id`:
- `name`: The name of the SVM.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ActiveDirectoryConfiguration"`: Describes the self-managed Microsoft Active Directory
  to which you want to join the SVM. Joining an Active Directory provides user authentication
  and access control for SMB clients, including Microsoft Windows and macOS client accessing
  the file system.
- `"ClientRequestToken"`:
- `"RootVolumeSecurityStyle"`: The security style of the root volume of the SVM. Specify
  one of the following values:    UNIX if the file system is managed by a UNIX administrator,
  the majority of users are NFS clients, and an application accessing the data uses a UNIX
  user as the service account.    NTFS if the file system is managed by a Windows
  administrator, the majority of users are SMB clients, and an application accessing the data
  uses a Windows user as the service account.    MIXED if the file system is managed by both
  UNIX and Windows administrators and users consist of both NFS and SMB clients.
- `"SvmAdminPassword"`: The password to use when managing the SVM using the NetApp ONTAP
  CLI or REST API. If you do not specify a password, you can still use the file system's
  fsxadmin user to manage the SVM.
- `"Tags"`:
"""
function create_storage_virtual_machine(
    FileSystemId, Name; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CreateStorageVirtualMachine",
        Dict{String,Any}(
            "FileSystemId" => FileSystemId,
            "Name" => Name,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_storage_virtual_machine(
    FileSystemId,
    Name,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateStorageVirtualMachine",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "FileSystemId" => FileSystemId,
                    "Name" => Name,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_volume(name, volume_type)
    create_volume(name, volume_type, params::Dict{String,<:Any})

Creates an Amazon FSx for NetApp ONTAP storage volume.

# Arguments
- `name`: Specifies the name of the volume you're creating.
- `volume_type`: Specifies the type of volume to create; ONTAP is the only valid volume
  type.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"OntapConfiguration"`: Specifies the ONTAP configuration to use in creating the volume.
- `"Tags"`:
"""
function create_volume(Name, VolumeType; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "CreateVolume",
        Dict{String,Any}(
            "Name" => Name,
            "VolumeType" => VolumeType,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_volume(
    Name,
    VolumeType,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateVolume",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "Name" => Name,
                    "VolumeType" => VolumeType,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    create_volume_from_backup(backup_id, name)
    create_volume_from_backup(backup_id, name, params::Dict{String,<:Any})

Creates a new Amazon FSx for NetApp ONTAP volume from an existing Amazon FSx volume backup.

# Arguments
- `backup_id`:
- `name`: The name of the new volume you're creating.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"OntapConfiguration"`: Specifies the configuration of the ONTAP volume that you are
  creating.
- `"Tags"`:
"""
function create_volume_from_backup(
    BackupId, Name; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "CreateVolumeFromBackup",
        Dict{String,Any}(
            "BackupId" => BackupId, "Name" => Name, "ClientRequestToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function create_volume_from_backup(
    BackupId,
    Name,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "CreateVolumeFromBackup",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "BackupId" => BackupId,
                    "Name" => Name,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_backup(backup_id)
    delete_backup(backup_id, params::Dict{String,<:Any})

Deletes an Amazon FSx backup, deleting its contents. After deletion, the backup no longer
exists, and its data is gone. The DeleteBackup call returns instantly. The backup will not
show up in later DescribeBackups calls.  The data in a deleted backup is also deleted and
can't be recovered by any means.

# Arguments
- `backup_id`: The ID of the backup you want to delete.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`: A string of up to 64 ASCII characters that Amazon FSx uses to
  ensure idempotent deletion. This is automatically filled on your behalf when using the CLI
  or SDK.
"""
function delete_backup(BackupId; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "DeleteBackup",
        Dict{String,Any}("BackupId" => BackupId, "ClientRequestToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_backup(
    BackupId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "DeleteBackup",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "BackupId" => BackupId, "ClientRequestToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_file_system(file_system_id)
    delete_file_system(file_system_id, params::Dict{String,<:Any})

Deletes a file system, deleting its contents. After deletion, the file system no longer
exists, and its data is gone. Any existing automatic backups will also be deleted. To
delete an Amazon FSx for NetApp ONTAP file system, first delete all the volumes and SVMs on
the file system. Then provide a FileSystemId value to the DeleFileSystem operation. By
default, when you delete an Amazon FSx for Windows File Server file system, a final backup
is created upon deletion. This final backup is not subject to the file system's retention
policy, and must be manually deleted. The DeleteFileSystem action returns while the file
system has the DELETING status. You can check the file system deletion status by calling
the DescribeFileSystems action, which returns a list of file systems in your account. If
you pass the file system ID for a deleted file system, the DescribeFileSystems returns a
FileSystemNotFound error.  Deleting an Amazon FSx for Lustre file system will fail with a
400 BadRequest if a data repository task is in a PENDING or EXECUTING state.   The data in
a deleted file system is also deleted and can't be recovered by any means.

# Arguments
- `file_system_id`: The ID of the file system you want to delete.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`: A string of up to 64 ASCII characters that Amazon FSx uses to
  ensure idempotent deletion. This is automatically filled on your behalf when using the
  Command Line Interface (CLI) or an Amazon Web Services SDK.
- `"LustreConfiguration"`:
- `"WindowsConfiguration"`:
"""
function delete_file_system(FileSystemId; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "DeleteFileSystem",
        Dict{String,Any}(
            "FileSystemId" => FileSystemId, "ClientRequestToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_file_system(
    FileSystemId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "DeleteFileSystem",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "FileSystemId" => FileSystemId, "ClientRequestToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_storage_virtual_machine(storage_virtual_machine_id)
    delete_storage_virtual_machine(storage_virtual_machine_id, params::Dict{String,<:Any})

Deletes an existing Amazon FSx for ONTAP storage virtual machine (SVM). Prior to deleting
an SVM, you must delete all non-root volumes in the SVM, otherwise the operation will fail.

# Arguments
- `storage_virtual_machine_id`: The ID of the SVM that you want to delete.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
"""
function delete_storage_virtual_machine(
    StorageVirtualMachineId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DeleteStorageVirtualMachine",
        Dict{String,Any}(
            "StorageVirtualMachineId" => StorageVirtualMachineId,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_storage_virtual_machine(
    StorageVirtualMachineId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "DeleteStorageVirtualMachine",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "StorageVirtualMachineId" => StorageVirtualMachineId,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    delete_volume(volume_id)
    delete_volume(volume_id, params::Dict{String,<:Any})

Deletes an Amazon FSx for NetApp ONTAP volume. When deleting a volume, you have the option
of creating a final backup. If you create a final backup, you have the option to apply Tags
to the backup. You need to have fsx:TagResource permission in order to apply tags to the
backup.

# Arguments
- `volume_id`: The ID of the volume you are deleting.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"OntapConfiguration"`: For Amazon FSx for ONTAP volumes, specify whether to take a final
  backup of the volume, and apply tags to the backup.
"""
function delete_volume(VolumeId; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "DeleteVolume",
        Dict{String,Any}("VolumeId" => VolumeId, "ClientRequestToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function delete_volume(
    VolumeId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "DeleteVolume",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "VolumeId" => VolumeId, "ClientRequestToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    describe_backups()
    describe_backups(params::Dict{String,<:Any})

Returns the description of specific Amazon FSx backups, if a BackupIds value is provided
for that backup. Otherwise, it returns all backups owned by your Amazon Web Services
account in the Amazon Web Services Region of the endpoint that you're calling. When
retrieving all backups, you can optionally specify the MaxResults parameter to limit the
number of backups in a response. If more backups remain, Amazon FSx returns a NextToken
value in the response. In this case, send a later request with the NextToken request
parameter set to the value of NextToken from the last response. This action is used in an
iterative process to retrieve a list of your backups. DescribeBackups is called first
without a NextTokenvalue. Then the action continues to be called with the NextToken
parameter set to the value of the last NextToken value until a response has no NextToken.
When using this action, keep the following in mind:   The implementation might return fewer
than MaxResults backup descriptions while still including a NextToken value.   The order of
backups returned in the response of one DescribeBackups call and the order of backups
returned across the responses of a multi-call iteration is unspecified.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"BackupIds"`: IDs of the backups you want to retrieve (String). This overrides any
  filters. If any IDs are not found, BackupNotFound will be thrown.
- `"Filters"`: Filters structure. Supported names are file-system-id, backup-type,
  file-system-type, and volume-id.
- `"MaxResults"`: Maximum number of backups to return in the response (integer). This
  parameter value must be greater than 0. The number of items that Amazon FSx returns is the
  minimum of the MaxResults parameter specified in the request and the service's internal
  maximum number of items per page.
- `"NextToken"`: Opaque pagination token returned from a previous DescribeBackups operation
  (String). If a token present, the action continues the list from where the returning call
  left off.
"""
function describe_backups(; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx("DescribeBackups"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET)
end
function describe_backups(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeBackups", params; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end

"""
    describe_data_repository_tasks()
    describe_data_repository_tasks(params::Dict{String,<:Any})

Returns the description of specific Amazon FSx for Lustre data repository tasks, if one or
more TaskIds values are provided in the request, or if filters are used in the request. You
can use filters to narrow the response to include just tasks for specific file systems, or
tasks in a specific lifecycle state. Otherwise, it returns all data repository tasks owned
by your Amazon Web Services account in the Amazon Web Services Region of the endpoint that
you're calling. When retrieving all tasks, you can paginate the response by using the
optional MaxResults parameter to limit the number of tasks returned in a response. If more
tasks remain, Amazon FSx returns a NextToken value in the response. In this case, send a
later request with the NextToken request parameter set to the value of NextToken from the
last response.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Filters"`: (Optional) You can use filters to narrow the DescribeDataRepositoryTasks
  response to include just tasks for specific file systems, or tasks in a specific lifecycle
  state.
- `"MaxResults"`:
- `"NextToken"`:
- `"TaskIds"`: (Optional) IDs of the tasks whose descriptions you want to retrieve (String).
"""
function describe_data_repository_tasks(; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "DescribeDataRepositoryTasks";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function describe_data_repository_tasks(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeDataRepositoryTasks",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    describe_file_system_aliases(file_system_id)
    describe_file_system_aliases(file_system_id, params::Dict{String,<:Any})

Returns the DNS aliases that are associated with the specified Amazon FSx for Windows File
Server file system. A history of all DNS aliases that have been associated with and
disassociated from the file system is available in the list of AdministrativeAction
provided in the DescribeFileSystems operation response.

# Arguments
- `file_system_id`: The ID of the file system to return the associated DNS aliases for
  (String).

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"MaxResults"`: Maximum number of DNS aliases to return in the response (integer). This
  parameter value must be greater than 0. The number of items that Amazon FSx returns is the
  minimum of the MaxResults parameter specified in the request and the service's internal
  maximum number of items per page.
- `"NextToken"`: Opaque pagination token returned from a previous DescribeFileSystemAliases
  operation (String). If a token is included in the request, the action continues the list
  from where the previous returning call left off.
"""
function describe_file_system_aliases(
    FileSystemId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeFileSystemAliases",
        Dict{String,Any}(
            "FileSystemId" => FileSystemId, "ClientRequestToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function describe_file_system_aliases(
    FileSystemId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "DescribeFileSystemAliases",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "FileSystemId" => FileSystemId, "ClientRequestToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    describe_file_systems()
    describe_file_systems(params::Dict{String,<:Any})

Returns the description of specific Amazon FSx file systems, if a FileSystemIds value is
provided for that file system. Otherwise, it returns descriptions of all file systems owned
by your Amazon Web Services account in the Amazon Web Services Region of the endpoint that
you're calling. When retrieving all file system descriptions, you can optionally specify
the MaxResults parameter to limit the number of descriptions in a response. If more file
system descriptions remain, Amazon FSx returns a NextToken value in the response. In this
case, send a later request with the NextToken request parameter set to the value of
NextToken from the last response. This action is used in an iterative process to retrieve a
list of your file system descriptions. DescribeFileSystems is called first without a
NextTokenvalue. Then the action continues to be called with the NextToken parameter set to
the value of the last NextToken value until a response has no NextToken. When using this
action, keep the following in mind:   The implementation might return fewer than MaxResults
file system descriptions while still including a NextToken value.   The order of file
systems returned in the response of one DescribeFileSystems call and the order of file
systems returned across the responses of a multicall iteration is unspecified.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"FileSystemIds"`: IDs of the file systems whose descriptions you want to retrieve
  (String).
- `"MaxResults"`: Maximum number of file systems to return in the response (integer). This
  parameter value must be greater than 0. The number of items that Amazon FSx returns is the
  minimum of the MaxResults parameter specified in the request and the service's internal
  maximum number of items per page.
- `"NextToken"`: Opaque pagination token returned from a previous DescribeFileSystems
  operation (String). If a token present, the action continues the list from where the
  returning call left off.
"""
function describe_file_systems(; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "DescribeFileSystems"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
function describe_file_systems(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeFileSystems",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    describe_storage_virtual_machines()
    describe_storage_virtual_machines(params::Dict{String,<:Any})

Describes one or more Amazon FSx for NetApp ONTAP storage virtual machines (SVMs).

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Filters"`: Enter a filter name:value pair to view a select set of SVMs.
- `"MaxResults"`:
- `"NextToken"`:
- `"StorageVirtualMachineIds"`: Enter the ID of one or more SVMs that you want to view.
"""
function describe_storage_virtual_machines(;
    aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeStorageVirtualMachines";
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function describe_storage_virtual_machines(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeStorageVirtualMachines",
        params;
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    describe_volumes()
    describe_volumes(params::Dict{String,<:Any})

Describes one or more Amazon FSx for NetApp ONTAP volumes.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Filters"`: Enter a filter name:value pair to view a select set of volumes.
- `"MaxResults"`:
- `"NextToken"`:
- `"VolumeIds"`: IDs of the volumes whose descriptions you want to retrieve.
"""
function describe_volumes(; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx("DescribeVolumes"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET)
end
function describe_volumes(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DescribeVolumes", params; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end

"""
    disassociate_file_system_aliases(aliases, file_system_id)
    disassociate_file_system_aliases(aliases, file_system_id, params::Dict{String,<:Any})

Use this action to disassociate, or remove, one or more Domain Name Service (DNS) aliases
from an Amazon FSx for Windows File Server file system. If you attempt to disassociate a
DNS alias that is not associated with the file system, Amazon FSx responds with a 400 Bad
Request. For more information, see Working with DNS Aliases. The system generated response
showing the DNS aliases that Amazon FSx is attempting to disassociate from the file system.
Use the API operation to monitor the status of the aliases Amazon FSx is disassociating
with the file system.

# Arguments
- `aliases`: An array of one or more DNS alias names to disassociate, or remove, from the
  file system.
- `file_system_id`: Specifies the file system from which to disassociate the DNS aliases.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
"""
function disassociate_file_system_aliases(
    Aliases, FileSystemId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "DisassociateFileSystemAliases",
        Dict{String,Any}(
            "Aliases" => Aliases,
            "FileSystemId" => FileSystemId,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function disassociate_file_system_aliases(
    Aliases,
    FileSystemId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "DisassociateFileSystemAliases",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "Aliases" => Aliases,
                    "FileSystemId" => FileSystemId,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    list_tags_for_resource(resource_arn)
    list_tags_for_resource(resource_arn, params::Dict{String,<:Any})

Lists tags for an Amazon FSx file systems and backups in the case of Amazon FSx for Windows
File Server. When retrieving all tags, you can optionally specify the MaxResults parameter
to limit the number of tags in a response. If more tags remain, Amazon FSx returns a
NextToken value in the response. In this case, send a later request with the NextToken
request parameter set to the value of NextToken from the last response. This action is used
in an iterative process to retrieve a list of your tags. ListTagsForResource is called
first without a NextTokenvalue. Then the action continues to be called with the NextToken
parameter set to the value of the last NextToken value until a response has no NextToken.
When using this action, keep the following in mind:   The implementation might return fewer
than MaxResults file system descriptions while still including a NextToken value.   The
order of tags returned in the response of one ListTagsForResource call and the order of
tags returned across the responses of a multi-call iteration is unspecified.

# Arguments
- `resource_arn`: The ARN of the Amazon FSx resource that will have its tags listed.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: Maximum number of tags to return in the response (integer). This
  parameter value must be greater than 0. The number of items that Amazon FSx returns is the
  minimum of the MaxResults parameter specified in the request and the service's internal
  maximum number of items per page.
- `"NextToken"`: Opaque pagination token returned from a previous ListTagsForResource
  operation (String). If a token present, the action continues the list from where the
  returning call left off.
"""
function list_tags_for_resource(
    ResourceARN; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "ListTagsForResource",
        Dict{String,Any}("ResourceARN" => ResourceARN);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function list_tags_for_resource(
    ResourceARN,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "ListTagsForResource",
        Dict{String,Any}(
            mergewith(_merge, Dict{String,Any}("ResourceARN" => ResourceARN), params)
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    tag_resource(resource_arn, tags)
    tag_resource(resource_arn, tags, params::Dict{String,<:Any})

Tags an Amazon FSx resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the Amazon FSx resource that you want
  to tag.
- `tags`: A list of tags for the resource. If a tag with a given key already exists, the
  value is replaced by the one specified in this parameter.

"""
function tag_resource(ResourceARN, Tags; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "TagResource",
        Dict{String,Any}("ResourceARN" => ResourceARN, "Tags" => Tags);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function tag_resource(
    ResourceARN,
    Tags,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "TagResource",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}("ResourceARN" => ResourceARN, "Tags" => Tags),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    untag_resource(resource_arn, tag_keys)
    untag_resource(resource_arn, tag_keys, params::Dict{String,<:Any})

This action removes a tag from an Amazon FSx resource.

# Arguments
- `resource_arn`: The ARN of the Amazon FSx resource to untag.
- `tag_keys`: A list of keys of tags on the resource to untag. In case the tag key doesn't
  exist, the call will still succeed to be idempotent.

"""
function untag_resource(
    ResourceARN, TagKeys; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "UntagResource",
        Dict{String,Any}("ResourceARN" => ResourceARN, "TagKeys" => TagKeys);
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function untag_resource(
    ResourceARN,
    TagKeys,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "UntagResource",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}("ResourceARN" => ResourceARN, "TagKeys" => TagKeys),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_file_system(file_system_id)
    update_file_system(file_system_id, params::Dict{String,<:Any})

Use this operation to update the configuration of an existing Amazon FSx file system. You
can update multiple properties in a single request. For Amazon FSx for Windows File Server
file systems, you can update the following properties:   AuditLogConfiguration
AutomaticBackupRetentionDays   DailyAutomaticBackupStartTime
SelfManagedActiveDirectoryConfiguration   StorageCapacity   ThroughputCapacity
WeeklyMaintenanceStartTime   For Amazon FSx for Lustre file systems, you can update the
following properties:   AutoImportPolicy   AutomaticBackupRetentionDays
DailyAutomaticBackupStartTime   DataCompressionType   StorageCapacity
WeeklyMaintenanceStartTime   For Amazon FSx for NetApp ONTAP file systems, you can update
the following properties:   AutomaticBackupRetentionDays   DailyAutomaticBackupStartTime
FsxAdminPassword   WeeklyMaintenanceStartTime

# Arguments
- `file_system_id`: Identifies the file system that you are updating.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`: A string of up to 64 ASCII characters that Amazon FSx uses to
  ensure idempotent updates. This string is automatically filled on your behalf when you use
  the Command Line Interface (CLI) or an Amazon Web Services SDK.
- `"LustreConfiguration"`:
- `"OntapConfiguration"`:
- `"StorageCapacity"`: Use this parameter to increase the storage capacity of an Amazon FSx
  for Windows File Server or Amazon FSx for Lustre file system. Specifies the storage
  capacity target value, GiB, to increase the storage capacity for the file system that
  you're updating. You cannot make a storage capacity increase request if there is an
  existing storage capacity increase request in progress. For Windows file systems, the
  storage capacity target value must be at least 10 percent (%) greater than the current
  storage capacity value. In order to increase storage capacity, the file system must have at
  least 16 MB/s of throughput capacity. For Lustre file systems, the storage capacity target
  value can be the following:   For SCRATCH_2 and PERSISTENT_1 SSD deployment types, valid
  values are in multiples of 2400 GiB. The value must be greater than the current storage
  capacity.   For PERSISTENT HDD file systems, valid values are multiples of 6000 GiB for 12
  MB/s/TiB file systems and multiples of 1800 GiB for 40 MB/s/TiB file systems. The values
  must be greater than the current storage capacity.   For SCRATCH_1 file systems, you cannot
  increase the storage capacity.   For more information, see Managing storage capacity in the
  Amazon FSx for Windows File Server User Guide and Managing storage and throughput capacity
  in the Amazon FSx for Lustre User Guide.
- `"WindowsConfiguration"`: The configuration updates for an Amazon FSx for Windows File
  Server file system.
"""
function update_file_system(FileSystemId; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "UpdateFileSystem",
        Dict{String,Any}(
            "FileSystemId" => FileSystemId, "ClientRequestToken" => string(uuid4())
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_file_system(
    FileSystemId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "UpdateFileSystem",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "FileSystemId" => FileSystemId, "ClientRequestToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_storage_virtual_machine(storage_virtual_machine_id)
    update_storage_virtual_machine(storage_virtual_machine_id, params::Dict{String,<:Any})

Updates an Amazon FSx for ONTAP storage virtual machine (SVM).

# Arguments
- `storage_virtual_machine_id`: The ID of the SVM that you want to update, in the format
  svm-0123456789abcdef0.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ActiveDirectoryConfiguration"`: Updates the Microsoft Active Directory (AD)
  configuration for an SVM that is joined to an AD.
- `"ClientRequestToken"`:
- `"SvmAdminPassword"`: Enter a new SvmAdminPassword if you are updating it.
"""
function update_storage_virtual_machine(
    StorageVirtualMachineId; aws_config::AbstractAWSConfig=global_aws_config()
)
    return fsx(
        "UpdateStorageVirtualMachine",
        Dict{String,Any}(
            "StorageVirtualMachineId" => StorageVirtualMachineId,
            "ClientRequestToken" => string(uuid4()),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_storage_virtual_machine(
    StorageVirtualMachineId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "UpdateStorageVirtualMachine",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "StorageVirtualMachineId" => StorageVirtualMachineId,
                    "ClientRequestToken" => string(uuid4()),
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end

"""
    update_volume(volume_id)
    update_volume(volume_id, params::Dict{String,<:Any})

Updates an Amazon FSx for NetApp ONTAP volume's configuration.

# Arguments
- `volume_id`: Specifies the volume that you want to update, formatted
  fsvol-0123456789abcdef0.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientRequestToken"`:
- `"OntapConfiguration"`: The ONTAP configuration of the volume you are updating.
"""
function update_volume(VolumeId; aws_config::AbstractAWSConfig=global_aws_config())
    return fsx(
        "UpdateVolume",
        Dict{String,Any}("VolumeId" => VolumeId, "ClientRequestToken" => string(uuid4()));
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end
function update_volume(
    VolumeId,
    params::AbstractDict{String};
    aws_config::AbstractAWSConfig=global_aws_config(),
)
    return fsx(
        "UpdateVolume",
        Dict{String,Any}(
            mergewith(
                _merge,
                Dict{String,Any}(
                    "VolumeId" => VolumeId, "ClientRequestToken" => string(uuid4())
                ),
                params,
            ),
        );
        aws_config=aws_config,
        feature_set=SERVICE_FEATURE_SET,
    )
end


text:
"""
tabulatensold(half="no",c=.5,maxit=10,level=5; bigtitle="")

Makes the tabulates for the SIAM Review paper.

Makes convergence rate tables for Float16 computations.

Newton's Method in Mixed-Precision.

"""
function tabulatensold(half = "no", c = 0.5, maxit = 10, level = 5; bigtitle = "")
    Fdata = zeros(4, level, maxit + 1)
    dout = zeros(maxit + 1, level)
    fillFdata!(Fdata, level, half)
    #
    # Get the data for the tables
    #
    ipmax = 4
    if half == "yes"
        ipmax = 2
    end
    headers = ["n", "1024", "2048", "4096", "8192", "16384"]
    formats = "%d & %9.5e & %9.5e & %9.5e & %9.5e & %9.5e"
    Rates = zeros(maxit, 6)
    Rates[:, 2:6] = transpose(Fdata[1, 1:level, 2:maxit+1] ./ Fdata[1, 1:level, 1:maxit])
    Rates[:, 1] = 1:maxit
    fprintTeX(headers, formats, Rates)
    return Rates
end

function fillFdata!(Fdata, level, half)
    #
    # Read the data files and get organized.
    #
    loadme(fmt::String) = @eval @load($fmt)
    for ir = 1:level
        gridlev = 512 * (2^ir)
        mixedpfile = string("paper", string(gridlev), ".jld2")
#        mixedpfile = string("paper", string(gridlev), ".jld")
        loadme(mixedpfile)
        if half == "no"
            Fdata[1, ir, :] .= fout64.exactout.ithist
            Fdata[2, ir, :] .= fout64.fdout.ithist
            Fdata[3, ir, :] .= fout32.exactout.ithist
            Fdata[4, ir, :] .= fout32.fdout.ithist
        else
            Fdata[1, ir, :] .= fout16.exactout.ithist
            Fdata[2, ir, :] .= fout16.fdout.ithist
        end
    end
end

max_stars_repo_name: ctkelley/MPResults


text:
struct Pool{F,T}
    f::F
    capacity::Int
    buffers::Vector{Vector{T}}
end

Pool(f, capacity = 256) = Pool(f, capacity, empty!([[f()]]))

function initpool!(pool::Pool)
    buffers = pool.buffers
    resize!(buffers, Threads.nthreads())
    for i in eachindex(buffers)
        buffers[i] = empty!(eltype(buffers)(undef, pool.capacity))
    end
    return pool
end

function alloc!(pool::Pool, n::Integer)
    buffer = pool.buffers[Threads.threadid()]
    i = max(1, length(buffer) - n + 1)
    objects = buffer[i:end]
    resize!(buffer, i - 1)

    m = length(objects)
    if m < n
        resize!(objects, n)
        for k in m+1:n
            objects[k] = pool.f()
        end
    end

    return objects
end

function free!(pool::Pool{<:Any,T}, objects::AbstractVector{T}) where {T}
    buffer = pool.buffers[Threads.threadid()]
    append!(buffer, @view objects[1:min(end, pool.capacity - length(buffer))])
    return
end


text:
module Thermal
using ModelingToolkit, Symbolics, IfElse, OrdinaryDiffEq

@parameters t
D = Differential(t)

include("HeatTransfer/ideal_components.jl")
include("HeatTransfer/sensors.jl")
include("HeatTransfer/sources.jl")
include("utils.jl")

export # Thermal Components
       BodyRadiation, ConvectiveConductor, ConvectiveResistor,
       HeatCapacitor, ThermalConductor, ThermalResistor, ThermalCollector,
       # Thermal Sensors
       RelativeTemperatureSensor, HeatFlowSensor, TemperatureSensor,
       # Thermal Sources
       FixedHeatFlow, FixedTemperature, ThermalGround,
       connect, HeatPort

end