text:
function fused_messages!(session::Session)
    messages = []
    append!(messages, session.message_queue)
    for js in session.on_document_load
        push!(messages, Dict(:msg_type=>EvalJavascript, :payload=>js))
    end
    empty!(session.on_document_load)
    empty!(session.message_queue)
    return Dict(:msg_type=>FusedMessage, :payload=>messages)
end

function init_session(session::Session)
    put!(session.js_fully_loaded, true)
    send(session, fused_messages!(session))
end

function Session(connection=Base.RefValue{Union{WebSocket, Nothing, IOBuffer}}(nothing); url_serializer=UrlSerializer(), id=string(uuid4()))
    return Session(
        connection,
        Dict{String, Tuple{Bool, Observable}}(),
        Dict{Symbol, Any}[],
        Set{Asset}(),
        JSCode[],
        id,
        Channel{Bool}(1),
        init_session,
        url_serializer,
        Ref{Union{Nothing, JSException}}(nothing),
        Observable{Union{Nothing, Dict{String, Any}}}(nothing),
        Observable(false),
        Observables.ObserverFunction[],
        Dict{String, WeakRef}()
    )
end

function Session(session::Session;
                connection=session.connection,
                observables=session.observables,
                message_queue=session.message_queue,
                dependencies=session.dependencies,
                on_document_load=session.on_document_load,
                id=session.id,
                js_fully_loaded=session.js_fully_loaded,
                on_websocket_ready=session.on_websocket_ready,
                url_serializer=session.url_serializer,
                init_error=session.init_error,
                js_comm=session.js_comm,
                on_close=session.on_close,
                deregister_callbacks=session.deregister_callbacks,
                unique_object_cache=session.unique_object_cache)
    return Session(
        connection,
        observables,
        message_queue,
        dependencies,
        on_document_load,
        id,
        js_fully_loaded,
        on_websocket_ready,
        url_serializer,
        init_error,
        js_comm,
        on_close,
        deregister_callbacks,
        unique_object_cache
    )
end

session(session::Session) = session

function Base.close(session::Session)
    try
        # https://github.com/JuliaWeb/HTTP.jl/issues/649
        if isassigned(session.connection) && !isnothing(session.connection[])
            close(session.connection[])
        end
    catch e
        if !(e isa Base.IOError)
            @warn "error while closing websocket!" exception=e
        end
    end
    try
        # Errors in `on_close` should not disrupt closing!
        session.on_close[] = true
    catch e
        @warn "error while setting on_close" exception=e
    end
    empty!(session.observables)
    empty!(session.on_document_load)
    empty!(session.message_queue)
    empty!(session.dependencies)
    # remove all listeners that where created for this session
    foreach(off, session.deregister_callbacks)
    empty!(session.deregister_callbacks)
    return
end

"""
    send(session::Session; attributes...)

Send values to the frontend via JSON for now
"""
Sockets.send(session::Session; kw...) = send(session, Dict{Symbol, Any}(kw))

function Sockets.send(session::Session, message::Dict{Symbol, Any})
    if isready(session)
        @assert isempty(session.message_queue)
        binary = serialize_binary(session, message)
        write(session.connection[], binary)
    else
        push!(session.message_queue, message)
    end
end

function Base.isready(session::Session)
    return isready(session.js_fully_loaded) && isopen(session)
end

function Base.isopen(session::Session)
    return isassigned(session.connection) && !isnothing(session.connection[]) && isopen(session.connection[])
end

"""
    onjs(session::Session, obs::Observable, func::JSCode)

Register a javascript function with `session`, that get's called when `obs` gets a new value.
If the observable gets updated from the JS side, the calling of `func` will be triggered
entirely in javascript, without any communication with the Julia `session`.
"""
function onjs(session::Session, obs::Observable, func::JSCode)
    # register the callback with the JS session
    register_resource!(session, (obs, func))
    send(
        session;
        msg_type=OnjsCallback,
        id=obs.id,
        payload=JSCode([JSString("return "), func])
    )
end

function onjs(has_session, obs::Observable, func::JSCode)
    onjs(session(has_session), obs, func)
end

"""
    onload(session::Session, node::Node, func::JSCode)

calls javascript `func` with node, once node has been displayed.
"""
function onload(session::Session, node::Node, func::JSCode)
    on_document_load(session, js"($(func))($(node));")
end

"""
    on_document_load(session::Session, js::JSCode)

executes javascript after document is loaded
"""
function on_document_load(session::Session, js::JSCode)
    register_resource!(session, js)
    push!(session.on_document_load, js)
end

"""
    linkjs(session::Session, a::Observable, b::Observable)

for an open session, link a and b on the javascript side. This will also
Link the observables in Julia, but only as long as the session is active.
"""
function linkjs(session::Session, a::Observable, b::Observable)
    # register the callback with the JS session
    onjs(session, a, js"(v) => JSServe.update_obs($b, v)")
end

function linkjs(has_session, a::Observable, b::Observable)
    linkjs(session(has_session), a, b)
end

"""
    evaljs(session::Session, jss::JSCode)

Evaluate a javascript script in `session`.
"""
function evaljs(session::Session, jss::JSCode)
    register_resource!(session, jss)
    send(session; msg_type=EvalJavascript, payload=jss)
end

function evaljs(has_session, jss::JSCode)
    evaljs(session(has_session), jss)
end

"""
    evaljs_value(session::Session, js::JSCode)

Evals `js` code and returns the jsonified value.
Blocks until value is returned. May block indefinitely, when called with a session
that doesn't have a connection to the browser.
"""
function evaljs_value(session::Session, js; error_on_closed=true, time_out=10.0)
    if error_on_closed && !isopen(session)
        error("Session is not open and would result in this function to indefinitely block.
        It may unblock, if the browser is still connecting and opening the session later on. If this is expected,
        you may try setting `error_on_closed=false`")
    end

    comm = session.js_comm
    comm.val = nothing
    js_with_result = js"""
    try{
        const result = $(js);
        console.log(result)
        JSServe.update_obs($(comm), {result: result});
    }catch(e){
        JSServe.update_obs($(comm), {error: e.toString()});
    }
    """

    evaljs(session, js_with_result)
    # TODO, have an on error callback, that triggers when evaljs goes wrong
    # (e.g. because of syntax error that isn't caught by the above try catch!)

    tstart = time()
    while (time() - tstart < time_out) && isnothing(comm[])
        yield()
    end
    value = comm[]
    if isnothing(value)
        error("Timed out")
    end
    if haskey(value, "error")
        error(value["error"])
    else
        return value["result"]
    end
end

function evaljs_value(with_session, js; error_on_closed=true, time_out=100.0)
    evaljs_value(session(with_session), js; error_on_closed=error_on_closed, time_out=time_out)
end

"""
    register_resource!(session::Session, domlike)

Walks dom like structures and registers all resources (Observables, Assets Depencies)
with the session.
"""
register_resource!(session::Session, @nospecialize(obj)) = nothing # do nothing for unknown type

function register_resource!(session::Session, list::Union{Tuple, AbstractVector, Pair})
    for elem in list
        register_resource!(session, elem)
    end
end

function register_resource!(session::Session, dict::Union{NamedTuple, AbstractDict})
    for (k, v) in pairs(dict)
        register_resource!(session, v)
        register_resource!(session, k)
    end
end

function register_resource!(session::Session, jss::JSCode)
    register_resource!(session, jss.source)
end

function register_resource!(session::Session, asset::Union{Asset, Dependency, Observable})
    push!(session, asset)
end

function register_resource!(session::Session, node::Node)
    walk_dom(node) do x
        register_resource!(session, x)
    end
end

function Base.push!(session::Session, observable::Observable)
    if !haskey(session.observables, observable.id)
        session.observables[observable.id] = (true, observable)
        # Register on the JS side by sending the current value
        updater = JSUpdateObservable(session, observable.id)
        on(updater, session, observable)
        # Make sure we register on the js side
        send(session, payload=observable[], id=observable.id, msg_type=RegisterObservable)
    end
end

function Base.push!(session::Session, dependency::Dependency)
    for asset in dependency.assets
        push!(session, asset)
    end
    return dependency
end

function Base.push!(session::Session, asset::Asset)
    push!(session.dependencies, asset)
    if asset.onload !== nothing
        on_document_load(session, asset.onload)
    end
    return asset
end


text:
# Parallel instance of lsrtm_objective function
# Author: Mathias Louboutin, mloubutin3@gatech.edu
# Date: September 202-
#

"""
    lsrtm_objective(model, source, dobs, dm; options=Options())

Evaluate the least-square migration objective function. Returns a tuple with function value and \\
gradient. `model` is a `Model` structure with the current velocity model and `source` and `dobs` are the wavelets and \\
observed data of type `judiVector`.

Example
=======

    function_value, gradient = lsrtm_objective(model, source, dobs, dm)

"""
function lsrtm_objective(model::Model, source::judiVector, dObs::judiVector, dm; options=Options(), nlind=false)
# lsrtm_objective function for multiple sources. The function distributes the sources and the input data amongst the available workers.

    results = judipmap(j -> lsrtm_objective(model, source[j], dObs[j], dm, subsample(options, j); nlind=nlind), 1:dObs.nsrc)

    # Collect and reduce gradients
    obj, gradient = reduce((x, y) -> x .+ y, results)

    # first value corresponds to function value, the rest to the gradient
    return obj, gradient
end

function lsrtm_objective(model::Array{Model,1}, source::Array{judiVector{T,Array{T,2}},1}, dObs::Array{judiVector{T,Array{T,2}},1}, dm::Union{Array{Array{T,1},1}, Array{PhysicalParameter{T},1}}; options=Options(), nlind=false) where T
# lsrtm_objective function for multiple sources and multiple vintages. The function distributes the sources and the input data amongst the available workers.

    results = judipmap((m, q, d, d_m) -> lsrtm_objective(m, q, d, d_m; options=options, nlind=nlind), model, source, dObs, dm)

    obj = sum([results[i][1] for i = 1:length(results)])
    gradient = [results[i][2] for i = 1:length(results)]

    # first value corresponds to function value, the rest to the gradient
    return obj, gradient
end

ext: jl


text:
@doc """
    S = read_nodal(fmt, filestr [, keywords])

Read nodal data from file `filestr` into new NodalData object `S`.

## Keywords
|KW     | Type      | Default   | Used By   | Meaning                         |
|:---   |:---       |:---       |:---       |:---                             |
| chans | ChanSpec  | Int64[]   | all       | channel numbers to read in      |
| nn    | String    | "N0"      | all       | network name in `:id`           |
| s     | TimeSpec  |           | silixa    | start time [^1]                 |
| t     | TimeSpec  |           | silixa    | end time                        |
| v     | Integer   | 0         | silixa    | verbosity                       |

[^1] Special behavior: Real values supplied to `s=` and `t=` are treated as seconds *from file begin*; most SeisIO functions treat Real as seconds relative to current time.

See also: `TimeSpec`, `parsetimewin`, `read_data`
""" read_nodal
function read_nodal(fmt::String, fstr::String;
  chans   ::ChanSpec  = Int64[]                   , # channels to proess
  memmap  ::Bool      = false                     , # use mmap? (DANGEROUS)
  nn      ::String    = "N0"                      , # network name
  s       ::TimeSpec  = "0001-01-01T00:00:00"     , # Start
  t       ::TimeSpec  = "9999-12-31T12:59:59"     , # End or Length (s)
  v       ::Integer   = KW.v                      , # verbosity
  )

  if fmt == "silixa"
    S = read_silixa_tdms(fstr, nn, s, t, chans, memmap, v)
  elseif fmt == "segy"
    S = read_nodal_segy(fstr, nn, s, t, chans, memmap)
  else
    error("Unrecognized format String!")
  end
  return S
end


text:
# Image Quality Metrics

"""
    PSNR(img1, img2)

Computes peak-signal-to-noise ratio, in decibels, between two images `img1` and `img2`. The higher the PSNR, the better the quality of the compressed, or reconstructed image.
"""
function PSNR(img1, img2)
    mse = mean((img1 .- img2).^2)
    psnr = 255 * 255 / mse
    return 10 * log10(psnr)
end

# TODO: Add following functions
# Inception Score
# Frechet Inception Distance


text:
include("utils/stopwatch.jl")
include("model.jl")
include("cpmodification.jl")
include("fixPoint.jl")

include("search/strategies.jl")

include("../variableselection/variableselection.jl")
include("../valueselection/valueselection.jl")

include("search/search.jl")

include("solver.jl")


text:
function create(A::Matrix{}, b::Vector{}, c::Vector{};
                standard::Bool = true, rho::Float64 = 0.05, alpha::Float64 = 0.95, tol::Float64 = 1E-6, max_iter::Int = 1000,
                verbose::Bool = true, solver::Int = 0, crossover::Bool = false, crossover_tol::Float64 = 1E-3)
        if standard
            m = length(b)
            n = length(c)
        else
            m = length(b)
            extra = zeros(m,m)
            for i in 1:m
                extra[i,i] = 1.0
            end
            A = [A extra]
            c = [c; zeros(m)]
            n = length(c)
        end
        input = Input(A,b,c,standard,n,m,rho,alpha,tol,max_iter,verbose,solver,crossover, crossover_tol)
    return input
end

function update_midterm!(input::Input, midterm::MidTerm)
    A = input.A
    b = input.b
    c = input.c
    base = midterm.base
    B = view(A,:,base)
    x = B \ b
    midterm.z = c[base]'x

    x_opt = zeros(input.n)
    x_opt[base] = x

    midterm.x = x_opt
    nothing
end

function write_output(input::Input, midterm::MidTerm)

    if midterm.termination_status == 2
        output = OutputSimplex(midterm.d, Inf, midterm.termination_status, midterm.base, midterm.nbase)
        last_log(input, output)
    elseif midterm.termination_status == 1
        output = OutputSimplex(midterm.x, midterm.z, midterm.termination_status, midterm.base, midterm.nbase)
        last_log(input, output)
    elseif midterm.termination_status == 3
        output = OutputSimplex(midterm.x, midterm.z, midterm.termination_status, midterm.base, midterm.nbase)
        last_log(input, output)
    elseif midterm.termination_status == 0
        output = OutputSimplex(midterm.x, midterm.z, midterm.termination_status, midterm.base, midterm.nbase)
        last_log(input, output)
    end
    return output
end

function solve(input::Input)
    if input.solver == 0
        output = solve_simplex(input)
    elseif input.solver == 1
        output = solve_ip(input)
        if input.crossover && output.termination_status == 1
            output = crossover(input, output)
        end
    else
        error("Use solver = 0 para Simplex e solver = 1 para Pontos interiores.")
    end
    return output
end


text:
using UnifiedPseudopotentialFormat: analyzename

@testset "Test `analyzename`" begin
    @test_throws AssertionError analyzename(UPFFile("xxyyzz"))
    @test_throws AssertionError analyzename(UPFFile("xxyyzz.xml"))
    @test_throws ArgumentError analyzename(UPFFile("x.upf"))
    @test_throws ArgumentError analyzename(UPFFile("x.UPF"))
end


text:
# simulations.jl
# author = Aaron Watt
# email = aaron@acwatt.net
# description = Estimations on simulated data to test estimation issues for project
# Notes:
#       - all nu's are the symbol \nu not the letter v

# packages
using LinearAlgebra, Statistics, Random, Distributions

# create simulated data
b = 1
n = 2
T = 3
tvec = [t for t in 1:T]
b₀ = [1, 1]
a = [1, 0.5]
ν₀ = 0
β = [1, 1]
ρ = 0.9
σₐ, σᵤ = 1, 1
α = rand(Normal(0, σₐ), T)
μ = rand(Normal(0, σᵤ), n, T)

function νt(t)
    if t == 0
        return ν₀
    else
        return 1/n*sum([νit(i, t) for i in 1:n])
    end
end

function νit(i, t)
    return ρ*νt(t-1) + α[t] + μ[i, t]
end

ν = νt.(tvec)

# for i in 1:n, create n rows for the n dummies: [1 0 t t^2]
# for t in 1:T, create another set of n rows for time t
X = [[t for t in 1:T]; for i in 1:n]
# need to build the matrix X of t and t^2
function xt(t)
    return []
end

X = xt.(tvec)

function eit(i, t)..
    1/b*(b₀ + dot(a, tvec))
end


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

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

In a management account, an environment account connection request is accepted. When the
environment account connection request is accepted, AWS Proton can use the associated IAM
role to provision environment infrastructure resources in the associated environment
account. For more information, see Environment account connections in the AWS Proton
Administration guide.

# Arguments
- `id`: The ID of the environment account connection.

"""
accept_environment_account_connection(id; aws_config::AbstractAWSConfig=global_aws_config()) = proton("AcceptEnvironmentAccountConnection", Dict{String, Any}("id"=>id); aws_config=aws_config)
accept_environment_account_connection(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("AcceptEnvironmentAccountConnection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("id"=>id), params)); aws_config=aws_config)

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

Attempts to cancel an environment deployment on an UpdateEnvironment action, if the
deployment is IN_PROGRESS. For more information, see Update an environment in the AWS
Proton Administration guide. The following list includes potential cancellation scenarios.
 If the cancellation attempt succeeds, the resulting deployment state is CANCELLED.   If
the cancellation attempt fails, the resulting deployment state is FAILED.   If the current
UpdateEnvironment action succeeds before the cancellation attempt starts, the resulting
deployment state is SUCCEEDED and the cancellation attempt has no effect.

# Arguments
- `environment_name`: The name of the environment with the deployment to cancel.

"""
cancel_environment_deployment(environmentName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CancelEnvironmentDeployment", Dict{String, Any}("environmentName"=>environmentName); aws_config=aws_config)
cancel_environment_deployment(environmentName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CancelEnvironmentDeployment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("environmentName"=>environmentName), params)); aws_config=aws_config)

"""
    cancel_service_instance_deployment(service_instance_name, service_name)
    cancel_service_instance_deployment(service_instance_name, service_name, params::Dict{String,<:Any})

Attempts to cancel a service instance deployment on an UpdateServiceInstance action, if the
deployment is IN_PROGRESS. For more information, see Update a service instance in the AWS
Proton Administration guide or the AWS Proton User guide. The following list includes
potential cancellation scenarios.   If the cancellation attempt succeeds, the resulting
deployment state is CANCELLED.   If the cancellation attempt fails, the resulting
deployment state is FAILED.   If the current UpdateServiceInstance action succeeds before
the cancellation attempt starts, the resulting deployment state is SUCCEEDED and the
cancellation attempt has no effect.

# Arguments
- `service_instance_name`: The name of the service instance with the deployment to cancel.
- `service_name`: The name of the service with the service instance deployment to cancel.

"""
cancel_service_instance_deployment(serviceInstanceName, serviceName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CancelServiceInstanceDeployment", Dict{String, Any}("serviceInstanceName"=>serviceInstanceName, "serviceName"=>serviceName); aws_config=aws_config)
cancel_service_instance_deployment(serviceInstanceName, serviceName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CancelServiceInstanceDeployment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("serviceInstanceName"=>serviceInstanceName, "serviceName"=>serviceName), params)); aws_config=aws_config)

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

Attempts to cancel a service pipeline deployment on an UpdateServicePipeline action, if the
deployment is IN_PROGRESS. For more information, see Update a service pipeline in the AWS
Proton Administration guide or the AWS Proton User guide. The following list includes
potential cancellation scenarios.   If the cancellation attempt succeeds, the resulting
deployment state is CANCELLED.   If the cancellation attempt fails, the resulting
deployment state is FAILED.   If the current UpdateServicePipeline action succeeds before
the cancellation attempt starts, the resulting deployment state is SUCCEEDED and the
cancellation attempt has no effect.

# Arguments
- `service_name`: The name of the service with the service pipeline deployment to cancel.

"""
cancel_service_pipeline_deployment(serviceName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CancelServicePipelineDeployment", Dict{String, Any}("serviceName"=>serviceName); aws_config=aws_config)
cancel_service_pipeline_deployment(serviceName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CancelServicePipelineDeployment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("serviceName"=>serviceName), params)); aws_config=aws_config)

"""
    create_environment(name, spec, template_major_version, template_name)
    create_environment(name, spec, template_major_version, template_name, params::Dict{String,<:Any})

Deploy a new environment. An AWS Proton environment is created from an environment template
that defines infrastructure and resources that can be shared across services. For more
information, see the Environments in the AWS Proton Administration Guide.

# Arguments
- `name`: The name of the environment.
- `spec`: A link to a YAML formatted spec file that provides inputs as defined in the
  environment template bundle schema file. For more information, see Environments in the AWS
  Proton Administration Guide.
- `template_major_version`: The ID of the major version of the environment template.
- `template_name`: The name of the environment template. For more information, see
  Environment Templates in the AWS Proton Administration Guide.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of the environment that's being created and deployed.
- `"environmentAccountConnectionId"`: The ID of the environment account connection that you
  provide if you're provisioning your environment infrastructure resources to an environment
  account. You must include either the environmentAccountConnectionId or protonServiceRoleArn
  parameter and value. For more information, see Environment account connections in the AWS
  Proton Administration guide.
- `"protonServiceRoleArn"`: The Amazon Resource Name (ARN) of the AWS Proton service role
  that allows AWS Proton to make calls to other services on your behalf. You must include
  either the environmentAccountConnectionId or protonServiceRoleArn parameter and value.
- `"tags"`: Create tags for your environment. For more information, see AWS Proton
  resources and tagging in the AWS Proton Administration Guide or AWS Proton User Guide.
- `"templateMinorVersion"`: The ID of the minor version of the environment template.
"""
create_environment(name, spec, templateMajorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironment", Dict{String, Any}("name"=>name, "spec"=>spec, "templateMajorVersion"=>templateMajorVersion, "templateName"=>templateName); aws_config=aws_config)
create_environment(name, spec, templateMajorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name, "spec"=>spec, "templateMajorVersion"=>templateMajorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

"""
    create_environment_account_connection(environment_name, management_account_id, role_arn)
    create_environment_account_connection(environment_name, management_account_id, role_arn, params::Dict{String,<:Any})

Create an environment account connection in an environment account so that environment
infrastructure resources can be provisioned in the environment account from the management
account. An environment account connection is a secure bi-directional connection between a
management account and an environment account that maintains authorization and permissions.
For more information, see Environment account connections in the AWS Proton Administration
guide.

# Arguments
- `environment_name`: The name of the AWS Proton environment that's created in the
  associated management account.
- `management_account_id`: The ID of the management account that accepts or rejects the
  environment account connection. You create an manage the AWS Proton environment in this
  account. If the management account accepts the environment account connection, AWS Proton
  can use the associated IAM role to provision environment infrastructure resources in the
  associated environment account.
- `role_arn`: The Amazon Resource Name (ARN) of the IAM service role that's created in the
  environment account. AWS Proton uses this role to provision infrastructure resources in the
  associated environment account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: When included, if two identicial requests are made with the same client
  token, AWS Proton returns the environment account connection that the first request created.
"""
create_environment_account_connection(environmentName, managementAccountId, roleArn; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironmentAccountConnection", Dict{String, Any}("environmentName"=>environmentName, "managementAccountId"=>managementAccountId, "roleArn"=>roleArn, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_environment_account_connection(environmentName, managementAccountId, roleArn, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironmentAccountConnection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("environmentName"=>environmentName, "managementAccountId"=>managementAccountId, "roleArn"=>roleArn, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Create an environment template for AWS Proton. For more information, see Environment
Templates in the AWS Proton Administration Guide. You can create an environment template in
one of the two following ways:   Register and publish a standard environment template that
instructs AWS Proton to deploy and manage environment infrastructure.   Register and
publish a customer managed environment template that connects AWS Proton to your existing
provisioned infrastructure that you manage. AWS Proton doesn't manage your existing
provisioned infrastructure. To create an environment template for customer provisioned and
managed infrastructure, include the provisioning parameter and set the value to
CUSTOMER_MANAGED. For more information, see Register and publish an environment template in
the AWS Proton Administration Guide.

# Arguments
- `name`: The name of the environment template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of the environment template.
- `"displayName"`: The environment template name as displayed in the developer interface.
- `"encryptionKey"`: A customer provided encryption key that AWS Proton uses to encrypt
  data.
- `"provisioning"`: When included, indicates that the environment template is for customer
  provisioned and managed infrastructure.
- `"tags"`: Create tags for your environment template. For more information, see AWS Proton
  resources and tagging in the AWS Proton Administration Guide or AWS Proton User Guide.
"""
create_environment_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironmentTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
create_environment_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironmentTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    create_environment_template_version(source, template_name)
    create_environment_template_version(source, template_name, params::Dict{String,<:Any})

Create a new major or minor version of an environment template. A major version of an
environment template is a version that isn't backwards compatible. A minor version of an
environment template is a version that's backwards compatible within its major version.

# Arguments
- `source`: An object that includes the template bundle S3 bucket path and name for the new
  version of an template.
- `template_name`: The name of the environment template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: When included, if two identicial requests are made with the same client
  token, AWS Proton returns the environment template version that the first request created.
- `"description"`: A description of the new version of an environment template.
- `"majorVersion"`: To create a new minor version of the environment template, include a
  majorVersion. To create a new major and minor version of the environment template, exclude
  majorVersion.
- `"tags"`: Create tags for a new version of an environment template.
"""
create_environment_template_version(source, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironmentTemplateVersion", Dict{String, Any}("source"=>source, "templateName"=>templateName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_environment_template_version(source, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateEnvironmentTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("source"=>source, "templateName"=>templateName, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    create_service(name, spec, template_major_version, template_name)
    create_service(name, spec, template_major_version, template_name, params::Dict{String,<:Any})

Create an AWS Proton service. An AWS Proton service is an instantiation of a service
template and often includes several service instances and pipeline. For more information,
see Services in the AWS Proton Administration Guide and Services in the AWS Proton User
Guide.

# Arguments
- `name`: The service name.
- `spec`: A link to a spec file that provides inputs as defined in the service template
  bundle schema file. The spec file is in YAML format. Don’t include pipeline inputs in the
  spec if your service template doesn’t include a service pipeline. For more information,
  see Create a service in the AWS Proton Administration Guide and Create a service in the AWS
  Proton User Guide.
- `template_major_version`: The ID of the major version of the service template that was
  used to create the service.
- `template_name`: The name of the service template that's used to create the service.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"branchName"`: The name of the code repository branch that holds the code that's
  deployed in AWS Proton. Don't include this parameter if your service template doesn't
  include a service pipeline.
- `"description"`: A description of the AWS Proton service.
- `"repositoryConnectionArn"`: The ARN of the repository connection. For more information,
  see Set up repository connection in the AWS Proton Administration Guide and Getting started
  in the AWS Proton User Guide. Don't include this parameter if your service template doesn't
  include a service pipeline.
- `"repositoryId"`: The ID of the code repository. Don't include this parameter if your
  service template doesn't include a service pipeline.
- `"tags"`: Create tags for your service. For more information, see AWS Proton resources
  and tagging in the AWS Proton Administration Guide or AWS Proton User Guide.
- `"templateMinorVersion"`: The ID of the minor version of the service template that was
  used to create the service.
"""
create_service(name, spec, templateMajorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateService", Dict{String, Any}("name"=>name, "spec"=>spec, "templateMajorVersion"=>templateMajorVersion, "templateName"=>templateName); aws_config=aws_config)
create_service(name, spec, templateMajorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateService", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name, "spec"=>spec, "templateMajorVersion"=>templateMajorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

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

Create a service template. The administrator creates a service template to define
standardized infrastructure and an optional CICD service pipeline. Developers, in turn,
select the service template from AWS Proton. If the selected service template includes a
service pipeline definition, they provide a link to their source code repository. AWS
Proton then deploys and manages the infrastructure defined by the selected service
template. For more information, see Service Templates in the AWS Proton Administration
Guide.

# Arguments
- `name`: The name of the service template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of the service template.
- `"displayName"`: The name of the service template as displayed in the developer interface.
- `"encryptionKey"`: A customer provided encryption key that's used to encrypt data.
- `"pipelineProvisioning"`: AWS Proton includes a service pipeline for your service by
  default. When included, this parameter indicates that an AWS Proton service pipeline won't
  be included for your service. Once specified, this parameter can't be changed. For more
  information, see Service template bundles in the AWS Proton Administration Guide.
- `"tags"`: Create tags for your service template. For more information, see AWS Proton
  resources and tagging in the AWS Proton Administration Guide or AWS Proton User Guide.
"""
create_service_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateServiceTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
create_service_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateServiceTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    create_service_template_version(compatible_environment_templates, source, template_name)
    create_service_template_version(compatible_environment_templates, source, template_name, params::Dict{String,<:Any})

Create a new major or minor version of a service template. A major version of a service
template is a version that isn't backwards compatible. A minor version of a service
template is a version that's backwards compatible within its major version.

# Arguments
- `compatible_environment_templates`: An array of compatible environment template objects
  for the new version of a service template.
- `source`: An object that includes the template bundle S3 bucket path and name for the new
  version of a service template.
- `template_name`: The name of the service template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: When included, if two identicial requests are made with the same client
  token, AWS Proton returns the service template version that the first request created.
- `"description"`: A description of the new version of a service template.
- `"majorVersion"`: To create a new minor version of the service template, include a
  majorVersion. To create a new major and minor version of the service template, exclude
  majorVersion.
- `"tags"`: Create tags for a new version of a service template.
"""
create_service_template_version(compatibleEnvironmentTemplates, source, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateServiceTemplateVersion", Dict{String, Any}("compatibleEnvironmentTemplates"=>compatibleEnvironmentTemplates, "source"=>source, "templateName"=>templateName, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_service_template_version(compatibleEnvironmentTemplates, source, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("CreateServiceTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("compatibleEnvironmentTemplates"=>compatibleEnvironmentTemplates, "source"=>source, "templateName"=>templateName, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Delete an environment.

# Arguments
- `name`: The name of the environment to delete.

"""
delete_environment(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironment", Dict{String, Any}("name"=>name); aws_config=aws_config)
delete_environment(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

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

In an environment account, delete an environment account connection. After you delete an
environment account connection that’s in use by an AWS Proton environment, AWS Proton
can’t manage the environment infrastructure resources until a new environment account
connection is accepted for the environment account and associated environment. You're
responsible for cleaning up provisioned resources that remain without an environment
connection. For more information, see Environment account connections in the AWS Proton
Administration guide.

# Arguments
- `id`: The ID of the environment account connection to delete.

"""
delete_environment_account_connection(id; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironmentAccountConnection", Dict{String, Any}("id"=>id); aws_config=aws_config)
delete_environment_account_connection(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironmentAccountConnection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("id"=>id), params)); aws_config=aws_config)

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

If no other major or minor versions of an environment template exist, delete the
environment template.

# Arguments
- `name`: The name of the environment template to delete.

"""
delete_environment_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironmentTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
delete_environment_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironmentTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    delete_environment_template_version(major_version, minor_version, template_name)
    delete_environment_template_version(major_version, minor_version, template_name, params::Dict{String,<:Any})

If no other minor versions of an environment template exist, delete a major version of the
environment template if it's not the Recommended version. Delete the Recommended version of
the environment template if no other major versions or minor versions of the environment
template exist. A major version of an environment template is a version that's not
backwards compatible. Delete a minor version of an environment template if it isn't the
Recommended version. Delete a Recommended minor version of the environment template if no
other minor versions of the environment template exist. A minor version of an environment
template is a version that's backwards compatible.

# Arguments
- `major_version`: The environment template major version to delete.
- `minor_version`: The environment template minor version to delete.
- `template_name`: The name of the environment template.

"""
delete_environment_template_version(majorVersion, minorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironmentTemplateVersion", Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName); aws_config=aws_config)
delete_environment_template_version(majorVersion, minorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteEnvironmentTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

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

Delete a service.

# Arguments
- `name`: The name of the service to delete.

"""
delete_service(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteService", Dict{String, Any}("name"=>name); aws_config=aws_config)
delete_service(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteService", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

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

If no other major or minor versions of the service template exist, delete the service
template.

# Arguments
- `name`: The name of the service template to delete.

"""
delete_service_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteServiceTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
delete_service_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteServiceTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    delete_service_template_version(major_version, minor_version, template_name)
    delete_service_template_version(major_version, minor_version, template_name, params::Dict{String,<:Any})

If no other minor versions of a service template exist, delete a major version of the
service template if it's not the Recommended version. Delete the Recommended version of the
service template if no other major versions or minor versions of the service template
exist. A major version of a service template is a version that isn't backwards compatible.
Delete a minor version of a service template if it's not the Recommended version. Delete a
Recommended minor version of the service template if no other minor versions of the service
template exist. A minor version of a service template is a version that's backwards
compatible.

# Arguments
- `major_version`: The service template major version to delete.
- `minor_version`: The service template minor version to delete.
- `template_name`: The name of the service template.

"""
delete_service_template_version(majorVersion, minorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteServiceTemplateVersion", Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName); aws_config=aws_config)
delete_service_template_version(majorVersion, minorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("DeleteServiceTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

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

Get detail data for the AWS Proton pipeline service role.

"""
get_account_settings(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetAccountSettings"; aws_config=aws_config)
get_account_settings(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetAccountSettings", params; aws_config=aws_config)

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

Get detail data for an environment.

# Arguments
- `name`: The name of the environment that you want to get the detail data for.

"""
get_environment(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironment", Dict{String, Any}("name"=>name); aws_config=aws_config)
get_environment(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

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

In an environment account, view the detail data for an environment account connection. For
more information, see Environment account connections in the AWS Proton Administration
guide.

# Arguments
- `id`: The ID of the environment account connection.

"""
get_environment_account_connection(id; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironmentAccountConnection", Dict{String, Any}("id"=>id); aws_config=aws_config)
get_environment_account_connection(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironmentAccountConnection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("id"=>id), params)); aws_config=aws_config)

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

Get detail data for an environment template.

# Arguments
- `name`: The name of the environment template that you want to get the detail data for.

"""
get_environment_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironmentTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
get_environment_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironmentTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    get_environment_template_version(major_version, minor_version, template_name)
    get_environment_template_version(major_version, minor_version, template_name, params::Dict{String,<:Any})

View detail data for a major or minor version of an environment template.

# Arguments
- `major_version`: To view environment template major version detail data, include
  majorVersion.
- `minor_version`: To view environment template minor version detail data, include
  minorVersion.
- `template_name`: The name of the environment template.

"""
get_environment_template_version(majorVersion, minorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironmentTemplateVersion", Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName); aws_config=aws_config)
get_environment_template_version(majorVersion, minorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetEnvironmentTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

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

Get detail data for a service.

# Arguments
- `name`: The name of the service that you want to get the detail data for.

"""
get_service(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetService", Dict{String, Any}("name"=>name); aws_config=aws_config)
get_service(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetService", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    get_service_instance(name, service_name)
    get_service_instance(name, service_name, params::Dict{String,<:Any})

Get detail data for a service instance. A service instance is an instantiation of service
template, which is running in a specific environment.

# Arguments
- `name`: The name of a service instance that you want to get the detail data for.
- `service_name`: The name of the service that the service instance belongs to.

"""
get_service_instance(name, serviceName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetServiceInstance", Dict{String, Any}("name"=>name, "serviceName"=>serviceName); aws_config=aws_config)
get_service_instance(name, serviceName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetServiceInstance", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name, "serviceName"=>serviceName), params)); aws_config=aws_config)

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

Get detail data for a service template.

# Arguments
- `name`: The name of the service template that you want to get detail data for.

"""
get_service_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetServiceTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
get_service_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetServiceTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    get_service_template_version(major_version, minor_version, template_name)
    get_service_template_version(major_version, minor_version, template_name, params::Dict{String,<:Any})

View detail data for a major or minor version of a service template.

# Arguments
- `major_version`: To view service template major version detail data, include majorVersion.
- `minor_version`: To view service template minor version detail data, include minorVersion.
- `template_name`: The name of the service template.

"""
get_service_template_version(majorVersion, minorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetServiceTemplateVersion", Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName); aws_config=aws_config)
get_service_template_version(majorVersion, minorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("GetServiceTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

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

View a list of environment account connections. For more information, see Environment
account connections in the AWS Proton Administration guide.

# Arguments
- `requested_by`: The type of account making the ListEnvironmentAccountConnections request.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"environmentName"`: The environment name that's associated with each listed environment
  account connection.
- `"maxResults"`: The maximum number of environment account connections to list.
- `"nextToken"`: A token to indicate the location of the next environment account
  connection in the array of environment account connections, after the list of environment
  account connections that was previously requested.
- `"statuses"`: The status details for each listed environment account connection.
"""
list_environment_account_connections(requestedBy; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironmentAccountConnections", Dict{String, Any}("requestedBy"=>requestedBy); aws_config=aws_config)
list_environment_account_connections(requestedBy, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironmentAccountConnections", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("requestedBy"=>requestedBy), params)); aws_config=aws_config)

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

List major or minor versions of an environment template with detail data.

# Arguments
- `template_name`: The name of the environment template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"majorVersion"`: To view a list of minor of versions under a major version of an
  environment template, include majorVersion. To view a list of major versions of an
  environment template, exclude majorVersion.
- `"maxResults"`: The maximum number of major or minor versions of an environment template
  to list.
- `"nextToken"`: A token to indicate the location of the next major or minor version in the
  array of major or minor versions of an environment template, after the list of major or
  minor versions that was previously requested.
"""
list_environment_template_versions(templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironmentTemplateVersions", Dict{String, Any}("templateName"=>templateName); aws_config=aws_config)
list_environment_template_versions(templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironmentTemplateVersions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("templateName"=>templateName), params)); aws_config=aws_config)

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

List environment templates.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of environment templates to list.
- `"nextToken"`: A token to indicate the location of the next environment template in the
  array of environment templates, after the list of environment templates that was previously
  requested.
"""
list_environment_templates(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironmentTemplates"; aws_config=aws_config)
list_environment_templates(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironmentTemplates", params; aws_config=aws_config)

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

List environments with detail data summaries.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"environmentTemplates"`: An array of the versions of the environment template.
- `"maxResults"`: The maximum number of environments to list.
- `"nextToken"`: A token to indicate the location of the next environment in the array of
  environments, after the list of environments that was previously requested.
"""
list_environments(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironments"; aws_config=aws_config)
list_environments(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListEnvironments", params; aws_config=aws_config)

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

List service instances with summaries of detail data.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of service instances to list.
- `"nextToken"`: A token to indicate the location of the next service in the array of
  service instances, after the list of service instances that was previously requested.
- `"serviceName"`: The name of the service that the service instance belongs to.
"""
list_service_instances(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServiceInstances"; aws_config=aws_config)
list_service_instances(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServiceInstances", params; aws_config=aws_config)

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

List major or minor versions of a service template with detail data.

# Arguments
- `template_name`: The name of the service template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"majorVersion"`: To view a list of minor of versions under a major version of a service
  template, include majorVersion. To view a list of major versions of a service template,
  exclude majorVersion.
- `"maxResults"`: The maximum number of major or minor versions of a service template to
  list.
- `"nextToken"`: A token to indicate the location of the next major or minor version in the
  array of major or minor versions of a service template, after the list of major or minor
  versions that was previously requested.
"""
list_service_template_versions(templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServiceTemplateVersions", Dict{String, Any}("templateName"=>templateName); aws_config=aws_config)
list_service_template_versions(templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServiceTemplateVersions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("templateName"=>templateName), params)); aws_config=aws_config)

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

List service templates with detail data.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of service templates to list.
- `"nextToken"`: A token to indicate the location of the next service template in the array
  of service templates, after the list of service templates previously requested.
"""
list_service_templates(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServiceTemplates"; aws_config=aws_config)
list_service_templates(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServiceTemplates", params; aws_config=aws_config)

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

List services with summaries of detail data.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of services to list.
- `"nextToken"`: A token to indicate the location of the next service in the array of
  services, after the list of services that was previously requested.
"""
list_services(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServices"; aws_config=aws_config)
list_services(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListServices", params; aws_config=aws_config)

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

List tags for a resource. For more information, see AWS Proton resources and tagging in the
AWS Proton Administration Guide or AWS Proton User Guide.

# Arguments
- `resource_arn`: The ARN of the resource for the listed tags.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of tags to list.
- `"nextToken"`: A token to indicate the location of the next resource tag in the array of
  resource tags, after the list of resource tags that was previously requested.
"""
list_tags_for_resource(resourceArn; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListTagsForResource", Dict{String, Any}("resourceArn"=>resourceArn); aws_config=aws_config)
list_tags_for_resource(resourceArn, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("ListTagsForResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("resourceArn"=>resourceArn), params)); aws_config=aws_config)

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

In a management account, reject an environment account connection from another environment
account. After you reject an environment account connection request, you won’t be able to
accept or use the rejected environment account connection. You can’t reject an
environment account connection that is connected to an environment. For more information,
see Environment account connections in the AWS Proton Administration guide.

# Arguments
- `id`: The ID of the environment account connection to reject.

"""
reject_environment_account_connection(id; aws_config::AbstractAWSConfig=global_aws_config()) = proton("RejectEnvironmentAccountConnection", Dict{String, Any}("id"=>id); aws_config=aws_config)
reject_environment_account_connection(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("RejectEnvironmentAccountConnection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("id"=>id), params)); aws_config=aws_config)

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

Tag a resource. For more information, see AWS Proton resources and tagging in the AWS
Proton Administration Guide or AWS Proton User Guide.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource that the resource tag is
  applied to.
- `tags`: An array of resource tags to apply to a resource.

"""
tag_resource(resourceArn, tags; aws_config::AbstractAWSConfig=global_aws_config()) = proton("TagResource", Dict{String, Any}("resourceArn"=>resourceArn, "tags"=>tags); aws_config=aws_config)
tag_resource(resourceArn, tags, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("TagResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("resourceArn"=>resourceArn, "tags"=>tags), params)); aws_config=aws_config)

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

Remove a tag from a resource. For more information, see AWS Proton resources and tagging in
the AWS Proton Administration Guide or AWS Proton User Guide.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource that the tag is to be
  removed from.
- `tag_keys`: An array of tag keys indicating the resource tags to be removed from the
  resource.

"""
untag_resource(resourceArn, tagKeys; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UntagResource", Dict{String, Any}("resourceArn"=>resourceArn, "tagKeys"=>tagKeys); aws_config=aws_config)
untag_resource(resourceArn, tagKeys, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UntagResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("resourceArn"=>resourceArn, "tagKeys"=>tagKeys), params)); aws_config=aws_config)

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

Update the AWS Proton pipeline service account settings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"pipelineServiceRoleArn"`: The Amazon Resource Name (ARN) of the AWS Proton pipeline
  service role.
"""
update_account_settings(; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateAccountSettings"; aws_config=aws_config)
update_account_settings(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateAccountSettings", params; aws_config=aws_config)

"""
    update_environment(deployment_type, name)
    update_environment(deployment_type, name, params::Dict{String,<:Any})

Update an environment. If the environment is associated with an environment account
connection, don't update or include the protonServiceRoleArn parameter to update or connect
to an environment account connection.  You can only update to a new environment account
connection if it was created in the same environment account that the current environment
account connection was created in and associated with the current environment. If the
environment isn't associated with an environment account connection, don't update or
include the environmentAccountConnectionId parameter to update or connect to an environment
account connection. You can update either the environmentAccountConnectionId or
protonServiceRoleArn parameter and value. You can’t update both. There are four modes for
updating an environment as described in the following. The deploymentType field defines the
mode.     NONE  In this mode, a deployment doesn't occur. Only the requested metadata
parameters are updated.     CURRENT_VERSION  In this mode, the environment is deployed and
updated with the new spec that you provide. Only requested parameters are updated. Don’t
include minor or major version parameters when you use this deployment-type.
MINOR_VERSION  In this mode, the environment is deployed and updated with the published,
recommended (latest) minor version of the current major version in use, by default. You can
also specify a different minor version of the current major version in use.
MAJOR_VERSION  In this mode, the environment is deployed and updated with the published,
recommended (latest) major and minor version of the current template, by default. You can
also specify a different major version that's higher than the major version in use and a
minor version (optional).

# Arguments
- `deployment_type`: There are four modes for updating an environment as described in the
  following. The deploymentType field defines the mode.     NONE  In this mode, a deployment
  doesn't occur. Only the requested metadata parameters are updated.     CURRENT_VERSION  In
  this mode, the environment is deployed and updated with the new spec that you provide. Only
  requested parameters are updated. Don’t include minor or major version parameters when
  you use this deployment-type.     MINOR_VERSION  In this mode, the environment is deployed
  and updated with the published, recommended (latest) minor version of the current major
  version in use, by default. You can also specify a different minor version of the current
  major version in use.     MAJOR_VERSION  In this mode, the environment is deployed and
  updated with the published, recommended (latest) major and minor version of the current
  template, by default. You can also specify a different major version that is higher than
  the major version in use and a minor version (optional).
- `name`: The name of the environment to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of the environment update.
- `"environmentAccountConnectionId"`: The ID of the environment account connection. You can
  only update to a new environment account connection if it was created in the same
  environment account that the current environment account connection was created in and
  associated with the current environment.
- `"protonServiceRoleArn"`: The ARN of the AWS Proton service role that allows AWS Proton
  to make API calls to other services your behalf.
- `"spec"`: The formatted specification that defines the update.
- `"templateMajorVersion"`: The ID of the major version of the environment to update.
- `"templateMinorVersion"`: The ID of the minor version of the environment to update.
"""
update_environment(deploymentType, name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironment", Dict{String, Any}("deploymentType"=>deploymentType, "name"=>name); aws_config=aws_config)
update_environment(deploymentType, name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironment", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("deploymentType"=>deploymentType, "name"=>name), params)); aws_config=aws_config)

"""
    update_environment_account_connection(id, role_arn)
    update_environment_account_connection(id, role_arn, params::Dict{String,<:Any})

In an environment account, update an environment account connection to use a new IAM role.
For more information, see Environment account connections in the AWS Proton Administration
guide.

# Arguments
- `id`: The ID of the environment account connection to update.
- `role_arn`: The Amazon Resource Name (ARN) of the IAM service role that is associated
  with the environment account connection to update.

"""
update_environment_account_connection(id, roleArn; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironmentAccountConnection", Dict{String, Any}("id"=>id, "roleArn"=>roleArn); aws_config=aws_config)
update_environment_account_connection(id, roleArn, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironmentAccountConnection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("id"=>id, "roleArn"=>roleArn), params)); aws_config=aws_config)

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

Update an environment template.

# Arguments
- `name`: The name of the environment template to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of the environment template update.
- `"displayName"`: The name of the environment template to update as displayed in the
  developer interface.
"""
update_environment_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironmentTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
update_environment_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironmentTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    update_environment_template_version(major_version, minor_version, template_name)
    update_environment_template_version(major_version, minor_version, template_name, params::Dict{String,<:Any})

Update a major or minor version of an environment template.

# Arguments
- `major_version`: To update a major version of an environment template, include
  majorVersion.
- `minor_version`: To update a minor version of an environment template, include
  minorVersion.
- `template_name`: The name of the environment template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of environment template version to update.
- `"status"`: The status of the environment template minor version to update.
"""
update_environment_template_version(majorVersion, minorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironmentTemplateVersion", Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName); aws_config=aws_config)
update_environment_template_version(majorVersion, minorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateEnvironmentTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName), params)); aws_config=aws_config)

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

Edit a service description or use a spec to add and delete service instances.  Existing
service instances and the service pipeline can't be edited using this API. They can only be
deleted.  Use the description parameter to modify the description. Edit the spec parameter
to add or delete instances.

# Arguments
- `name`: The name of the service to edit.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: The edited service description.
- `"spec"`: Lists the service instances to add and the existing service instances to
  remain. Omit the existing service instances to delete from the list. Don't include edits to
  the existing service instances or pipeline. For more information, see Edit a service in the
  AWS Proton Administration Guide or the AWS Proton User Guide.
"""
update_service(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateService", Dict{String, Any}("name"=>name); aws_config=aws_config)
update_service(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateService", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    update_service_instance(deployment_type, name, service_name)
    update_service_instance(deployment_type, name, service_name, params::Dict{String,<:Any})

Update a service instance. There are four modes for updating a service instance as
described in the following. The deploymentType field defines the mode.     NONE  In this
mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
CURRENT_VERSION  In this mode, the service instance is deployed and updated with the new
spec that you provide. Only requested parameters are updated. Don’t include minor or
major version parameters when you use this deployment-type.     MINOR_VERSION  In this
mode, the service instance is deployed and updated with the published, recommended (latest)
minor version of the current major version in use, by default. You can also specify a
different minor version of the current major version in use.     MAJOR_VERSION  In this
mode, the service instance is deployed and updated with the published, recommended (latest)
major and minor version of the current template, by default. You can also specify a
different major version that is higher than the major version in use and a minor version
(optional).

# Arguments
- `deployment_type`: The deployment type. There are four modes for updating a service
  instance as described in the following. The deploymentType field defines the mode.     NONE
   In this mode, a deployment doesn't occur. Only the requested metadata parameters are
  updated.     CURRENT_VERSION  In this mode, the service instance is deployed and updated
  with the new spec that you provide. Only requested parameters are updated. Don’t include
  minor or major version parameters when you use this deployment-type.     MINOR_VERSION  In
  this mode, the service instance is deployed and updated with the published, recommended
  (latest) minor version of the current major version in use, by default. You can also
  specify a different minor version of the current major version in use.     MAJOR_VERSION
  In this mode, the service instance is deployed and updated with the published, recommended
  (latest) major and minor version of the current template, by default. You can also specify
  a different major version that is higher than the major version in use and a minor version
  (optional).
- `name`: The name of the service instance to update.
- `service_name`: The name of the service that the service instance belongs to.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"spec"`: The formatted specification that defines the service instance update.
- `"templateMajorVersion"`: The major version of the service template to update.
- `"templateMinorVersion"`: The minor version of the service template to update.
"""
update_service_instance(deploymentType, name, serviceName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServiceInstance", Dict{String, Any}("deploymentType"=>deploymentType, "name"=>name, "serviceName"=>serviceName); aws_config=aws_config)
update_service_instance(deploymentType, name, serviceName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServiceInstance", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("deploymentType"=>deploymentType, "name"=>name, "serviceName"=>serviceName), params)); aws_config=aws_config)

"""
    update_service_pipeline(deployment_type, service_name, spec)
    update_service_pipeline(deployment_type, service_name, spec, params::Dict{String,<:Any})

Update the service pipeline. There are four modes for updating a service pipeline as
described in the following. The deploymentType field defines the mode.     NONE  In this
mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
CURRENT_VERSION  In this mode, the service pipeline is deployed and updated with the new
spec that you provide. Only requested parameters are updated. Don’t include minor or
major version parameters when you use this deployment-type.     MINOR_VERSION  In this
mode, the service pipeline is deployed and updated with the published, recommended (latest)
minor version of the current major version in use, by default. You can also specify a
different minor version of the current major version in use.     MAJOR_VERSION  In this
mode, the service pipeline is deployed and updated with the published, recommended (latest)
major and minor version of the current template by default. You can also specify a
different major version that is higher than the major version in use and a minor version
(optional).

# Arguments
- `deployment_type`: The deployment type. There are four modes for updating a service
  pipeline as described in the following. The deploymentType field defines the mode.     NONE
   In this mode, a deployment doesn't occur. Only the requested metadata parameters are
  updated.     CURRENT_VERSION  In this mode, the service pipeline is deployed and updated
  with the new spec that you provide. Only requested parameters are updated. Don’t include
  minor or major version parameters when you use this deployment-type.     MINOR_VERSION  In
  this mode, the service pipeline is deployed and updated with the published, recommended
  (latest) minor version of the current major version in use, by default. You can also
  specify a different minor version of the current major version in use.     MAJOR_VERSION
  In this mode, the service pipeline is deployed and updated with the published, recommended
  (latest) major and minor version of the current template, by default. You can also specify
  a different major version that is higher than the major version in use and a minor version
  (optional).
- `service_name`: The name of the service to that the pipeline is associated with.
- `spec`: The spec for the service pipeline to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"templateMajorVersion"`: The major version of the service template that was used to
  create the service that the pipeline is associated with.
- `"templateMinorVersion"`: The minor version of the service template that was used to
  create the service that the pipeline is associated with.
"""
update_service_pipeline(deploymentType, serviceName, spec; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServicePipeline", Dict{String, Any}("deploymentType"=>deploymentType, "serviceName"=>serviceName, "spec"=>spec); aws_config=aws_config)
update_service_pipeline(deploymentType, serviceName, spec, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServicePipeline", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("deploymentType"=>deploymentType, "serviceName"=>serviceName, "spec"=>spec), params)); aws_config=aws_config)

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

Update a service template.

# Arguments
- `name`: The name of the service template to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: A description of the service template update.
- `"displayName"`: The name of the service template to update as displayed in the developer
  interface.
"""
update_service_template(name; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServiceTemplate", Dict{String, Any}("name"=>name); aws_config=aws_config)
update_service_template(name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServiceTemplate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("name"=>name), params)); aws_config=aws_config)

"""
    update_service_template_version(major_version, minor_version, template_name)
    update_service_template_version(major_version, minor_version, template_name, params::Dict{String,<:Any})

Update a major or minor version of a service template.

# Arguments
- `major_version`: To update a major version of a service template, include majorVersion.
- `minor_version`: To update a minor version of a service template, include minorVersion.
- `template_name`: The name of the service template.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"compatibleEnvironmentTemplates"`: An array of compatible environment names for a
  service template major or minor version to update.
- `"description"`: A description of a service template version to update.
- `"status"`: The status of the service template minor version to update.
"""
update_service_template_version(majorVersion, minorVersion, templateName; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServiceTemplateVersion", Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName); aws_config=aws_config)
update_service_template_version(majorVersion, minorVersion, templateName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = proton("UpdateServiceTemplateVersion", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("majorVersion"=>majorVersion, "minorVersion"=>minorVersion, "templateName"=>templateName), params)); aws_config=aws_config)


text:
# -*- coding: utf-8 -*-
# ---
# jupyter:
#   jupytext:
#     formats: ipynb,jl:hydrogen
#     text_representation:
#       extension: .jl
#       format_name: hydrogen
#       format_version: '1.3'
#       jupytext_version: 1.10.3
#   kernelspec:
#     display_name: Julia 1.6.3
#     language: julia
#     name: julia-1.6
# ---

# %%
using BenchmarkTools
using CUDA
using Random

# %%
mcpi_cu_sum(n, t::Type{T}=Float32) where T = 4count(≤(1), sum(x->x^2, CUDA.rand(T, 2, n); dims=1))/n

@time mcpi_cu_sum(10^8)
@time mcpi_cu_sum(10^8)
@time mcpi_cu_sum(10^8)

# %%
@time mcpi_cu_sum(10^8, Float64)
@time mcpi_cu_sum(10^8, Float64)
@time mcpi_cu_sum(10^8, Float64)

# %%
mcpi_cu_count(n, t::Type{T}=Float32) where T = 4count(x -> x^2 + rand(T)^2 ≤ 1, CUDA.rand(T, n))/n

@time mcpi_cu_count(10^8)
@time mcpi_cu_count(10^8)
@time mcpi_cu_count(10^8)

# %%
mcpi_cu_count(n, t::Type{T}=Float32) where T = 4count(x -> x^2 + rand(T)^2 ≤ 1, CUDA.rand(T, n))/n

@time mcpi_cu_count(10^8, Float64)
@time mcpi_cu_count(10^8, Float64)
@time mcpi_cu_count(10^8, Float64)

# %%
function mcpi(n, t::Type{T}=Float32) where T
    rng = MersenneTwister()
    4count(_ -> rand(rng, T)^2 + rand(rng, T)^2 ≤ 1, 1:n)/n
end

@time mcpi(10^8)
@time mcpi(10^8)
@time mcpi(10^8)

# %%
@time mcpi(10^8, Float64)
@time mcpi(10^8, Float64)
@time mcpi(10^8, Float64)

# %%
@btime mcpi(10^8)
@btime mcpi_cu_sum(10^8)
@btime mcpi_cu_count(10^8)

# %%
@btime mcpi(10^8, Float64)
@btime mcpi_cu_sum(10^8, Float64)
@btime mcpi_cu_count(10^8, Float64)

# %%

max_stars_repo_path: 0023/mcpi cuda.jl

max_stars_repo_name: genkuroki/public

max_issues_repo_path: 0023/mcpi cuda.jl

max_issues_repo_name: genkuroki/public

max_forks_repo_path: 0023/mcpi cuda.jl

max_forks_repo_name: genkuroki/public


text:
# use of Symbols as node is deprecated
for f in (:DirectedEdge, :UndirectedEdge)
    @eval @test_deprecated $f(:a, :b)
    @eval @test_deprecated $f(:a, Node(:b))
    @eval @test_deprecated $f(Node(:a), :b)
end

struct Weight <: EdgeModifier
    w
end

struct Label <: NodeModifier
    l
end

@test_deprecated :a^Label(2)
@test_deprecated Label(2)^:a

@test_deprecated :a*Weight(2)
@test_deprecated Weight(2)*:a

@test_deprecated keep(:a, StenoGraphs.Left, AbstractNode)
@test_deprecated keep(:a, AbstractNode)


text:
using Pkg;
Pkg.activate(".");
Pkg.instantiate();
using GcodeParser;

Pkg.test();


text:
# Included in Common.jl

function eisner(edge_scores::Dict{(Int, Int), Real}, n::Int)
 	# n: number of words in sentence

	comp_rh = Dict{(Int, Int), Real}() # Complete span, right head. 	E[s][t][0][0]
	comp_lh = Dict{(Int, Int), Real}() # Complete span, left head. 		E[s][t][1][0]
	incomp_rh = Dict{(Int, Int), Real}() # Incomplete span, right head.	E[s][t][0][1]
	incomp_lh = Dict{(Int, Int), Real}() # Incomplete span, left head.	E[s][t][1][1]
	# TODO: sizehint()

	# backpointers
	bp_comp_rh = Dict{(Int, Int), Int}()
	bp_comp_lh = Dict{(Int, Int), Int}()
	bp_incomp_rh = Dict{(Int, Int), Int}()
	bp_incomp_lh = Dict{(Int, Int), Int}()

	for i = 0:n
		comp_rh[(i, i)] = 0
		comp_lh[(i, i)] = 0
		incomp_rh[(i, i)] = 0
		incomp_lh[(i, i)] = 0
	end

	for m = 1:n
		for s = 0:n
			t = s + m
			if (t > n) break end

			# E[s][t][0][1]
			tmp = -Inf
			bp = -1
			for q = s:t-1
				# get(edge_scores,(t, s), -Inf): IF edge's from a word to ROOT, then score = -Inf
				x = comp_rh[(q+1, t)] + get(edge_scores,(t, s), -Inf)
				if x > tmp
					tmp = x
					bp = q
				end
			end
			incomp_rh[(s, t)] = tmp
			bp_incomp_rh[(s, t)] = bp

			# E[s][t][1][1]
			tmp = -Inf
			bp = -1
			for q = s:t-1
				x = comp_lh[(s, q)] + comp_rh[(q+1, t)] + edge_scores[(s, t)]
				if x > tmp
					tmp = x
					bp = q
				end
			end
			incomp_lh[(s, t)] = tmp
			bp_incomp_lh[(s, t)] = bp

			# E[s][t][0][0]
			tmp = -Inf
			bp = -1
			for q = s:t-1
				x = comp_rh[(s, q)] + incomp_rh[(q, t)]
				if x > tmp
					tmp = x
					bp = q
				end
			end
			comp_rh[(s, t)] = tmp
			bp_comp_rh[(s, t)] = bp

			# E[s][t][1][0]
			tmp = -Inf
			for q = s+1:t
				x = incomp_lh[(s, q)] + comp_lh[(q, t)]
				if x > tmp
					tmp = x
					bp = q
				end
			end
			comp_lh[(s, t)] = tmp
			bp_comp_lh[(s, t)] = bp
		end
	end

	heads = cell(n)
	function backtrack(s, t, lr, ci)
		# lr: right head = 0, left head = 1
		# ci: comp = 0, incomp = 1
		if lr == 1 && ci == 0 # comp_lh
			if s != t
				q = bp_comp_lh[(s, t)]
				heads[q] = s
				heads[t] = q
				backtrack(s, q, 1, 1)
				backtrack(q, t, 1, 0)
			end
		elseif lr == 0 && ci == 0 # comp_rh
			if s != t
				q = bp_comp_rh[(s, t)]
				heads[q] = t
				heads[s] = q
				backtrack(s, q, 0, 0)
				backtrack(q, t, 0, 1)
			end
		elseif lr == 1 && ci == 1
			if s != t
				q = bp_incomp_lh[(s, t)]
				heads[t] = s
				backtrack(s, q, 1, 0)
				backtrack(q+1, t, 0, 0)
			end
		elseif lr == 0 && ci == 1
			if s != t
				q = bp_incomp_rh[(s, t)]
				heads[s] = t
				backtrack(s, q, 1, 0)
				backtrack(q+1, t, 0, 0)
			end
		end
	end
	backtrack(0, n, 1, 0)

	heads

end


text:
@testset "messaging tests" begin

    # This test makes the follow Objective-C calls in a low-level fashion
    # str = [[NSString alloc] initWithUTF8String: "hello"]
    # @test unsafe_string([str UTF8String]) == "hello"
    @testset "create a hello string" begin
        NSString = Class("NSString")

        # uninit_str = [NSString alloc]
        uninit_str = message(NSString, Selector("alloc"))
        @test uninit_str != nil

        # str = [uninit_str initWithUTF8String: "hello"]
        str = message(uninit_str, Selector("initWithUTF8String:"), "hello")
        @test str != nil

        # Turn NSString object into regular UTF8 chars
        chars = message(str, Selector("UTF8String"))
        @test chars != nil

        @test unsafe_string(chars) == "hello"
    end

    @testset "create integer" begin
        NSNumber = Class("NSNumber")

        num = message(NSNumber, Selector("numberWithInt:"), 42)
        x = message(num, Selector("intValue"))

        @test x == 42
    end
end


text:
using HorizonSideRobots

function inverse(side::HorizonSide)
    return HorizonSide((Int(side) + 2) % 4)
end

function movements!(r::Robot, side::HorizonSide, n::Int)
    while (n > 0 && isborder(r, Nord))
        move!(r, side)
        n -= 1
    end
end

function find_hole(r::Robot)
    step = 1
    cur_step = step
    side = Ost
    while isborder(r, Nord)
        movements!(r, side, cur_step)
        cur_step += step
        side = inverse(side)
    end
end

max_stars_repo_name: Mananhina/mirea-progs

max_issues_repo_name: Mananhina/mirea-progs

max_forks_repo_name: Mananhina/mirea-progs


text:
abstract type AbstractConfig end

"""
    BenchmarkConfigSweeps.nthreads(n::Integer) -> config

Configuration for running the benchmark with `n` threads.
"""
BenchmarkConfigSweeps.nthreads

struct NThreadsConfig <: AbstractConfig
    value::Int
end

function BenchmarkConfigSweeps.nthreads(n::Integer)
    n = Int(n)
    if n ≤ 0
        error("`nthreads` must be positive: got $n")
    end
    return NThreadsConfig(n)
end

"""
    BenchmarkConfigSweeps.julia(cmd) -> config

Specify Julia runtime for running the benchmark.
"""
BenchmarkConfigSweeps.julia

@auto_hash_equals struct JuliaConfig <: AbstractConfig
    cmd::Vector{String}
end

# TODO: check that env, dir etc. are not set
BenchmarkConfigSweeps.julia(cmd::Cmd) = JuliaConfig(cmd.exec)
BenchmarkConfigSweeps.julia(cmd) = JuliaConfig(`$cmd`.exec)

"""
    BenchmarkConfigSweeps.env(pairs) -> config
    BenchmarkConfigSweeps.env(pairs::Pair...) -> config

Configuration for running the benchmark with given set of environment variables.
"""
BenchmarkConfigSweeps.env

@auto_hash_equals struct ENVConfig <: AbstractConfig
    dict::Dict{String,Any}
    inherit::Bool
end

function BenchmarkConfigSweeps.env(kvs; inherit::Bool = true)
    dict = Dict{String,Any}()
    for (k, v) in kvs
        if k isa Symbol
            k = String(k)
        else
            k = convert(String, k)
        end
        if !(v isa Union{AbstractString,Real})
            error("unsupported type of value $v for key $k")
        end
        dict[k] = v
    end
    return ENVConfig(dict, inherit)
end

BenchmarkConfigSweeps.env(kvs::Pair...; options...) =
    BenchmarkConfigSweeps.env(kvs; options...)

asenv(::Nothing) = nothing
function asenv(cfg::ENVConfig)
    if cfg.inherit
        env = copy(ENV)
    else
        env = Dict{String,String}()
    end
    for (k, v) in cfg.dict
        if v isa AbstractString
            env[k] = v
        else
            env[k] = string(v)
        end
    end
    return env
end

mergeenv(a, b) = ENVConfig(merge(a.dict, b.dict), a.inherit | b.inherit)
mergeenv(env, ::Nothing) = env
mergeenv(::Nothing, env) = env
mergeenv(::Nothing, ::Nothing) = nothing

@auto_hash_equals struct Config <: AbstractConfig
    julia::Union{Nothing,JuliaConfig}
    nthreads::Union{Nothing,NThreadsConfig}
    env::Union{Nothing,ENVConfig}
end

Config() = Config(nothing, nothing, nothing)
Config(julia::JuliaConfig) = Config(julia, nothing, nothing)
Config(nthreads::NThreadsConfig) = Config(nothing, nthreads, nothing)
Config(env::ENVConfig) = Config(nothing, nothing, env)

Base.merge(a::AbstractConfig, b::AbstractConfig) = merge(asconfig(a), asconfig(b))
function Base.merge(a::Config, b::Config)
    a = @set a.julia = something(b.julia, a.julia, Some(nothing))
    a = @set a.nthreads = something(b.nthreads, a.nthreads, Some(nothing))
    a = @set a.env = mergeenv(a.env, b.env)
    return a
end

asconfig(cfg::Config) = cfg
asconfig(cfg::AbstractConfig) = Config(cfg)
asconfig(configs::Tuple) = mapfoldl(asconfig, merge, configs; init = Config())

function Base.Cmd(cfg::Config)
    if cfg.julia === nothing
        cmd = Base.julia_cmd()
    else
        cmd = Cmd(cfg.julia.cmd)
    end
    if cfg.nthreads !== nothing
        cmd = `$cmd --threads=$(cfg.nthreads.value)`
    end
    env = asenv(cfg.env)
    if env !== nothing
        cmd = setenv(cmd, env)
    end
    return cmd
end

function Base.show(io::IO, cfg::NThreadsConfig)
    print(io, BenchmarkConfigSweeps, ".nthreads(", cfg.value, ")")
end

function Base.show(io::IO, cfg::JuliaConfig)
    print(io, BenchmarkConfigSweeps, ".julia(")
    show(io, cfg.cmd)
    print(io, ')')
end

function Base.show(io::IO, cfg::ENVConfig)
    print(io, BenchmarkConfigSweeps, ".env(")
    # TODO: don't print everything when `cfg.dict` is too large
    for (i, (k, v)) in enumerate(cfg.dict)
        i > 1 && print(io, ", ")
        show(io, k => v)
    end
    if cfg.inherit
        print(io, "; inherit = true")
    end
    print(io, ')')
end

StructTypes.StructType(::Type{<:AbstractConfig}) = StructTypes.Struct()


text:
# https://github.com/JuliaInterop/Cxx.jl/blob/d74704b3eeb6dfd9c82e21fad4bd55a700e2256b/src/bootstrap.cpp#L1419-L1427
# Need RTTI due to:
# cgal/STL_Extension/include/CGAL/Handle_for_virtual.h:39:14: error: cannot use typeid with -fno-rtti
ENV["JULIA_CXX_RTTI"] = 1
# note, if you get `error: run-time type information was disabled in PCH file but is currently enabled`
# then you should do `Pkg.build("Cxx")`
# https://github.com/JuliaInterop/Cxx.jl/pull/313#issuecomment-324859107
using Cxx

deps_path = realpath(joinpath(@__DIR__, "..", "deps"))
cgal_base_path = joinpath(deps_path, "cgal")

boost_include_path = joinpath(deps_path, "usr/include")
Cxx.addHeaderDir(boost_include_path, kind=C_System)

find_cgal_package_include_dir_path(cgal_package) = joinpath(cgal_base_path, cgal_package, "include")

function find_dependencies0(cgal_package_name, depth=0)
  dependencies_file_path = joinpath(cgal_base_path, cgal_package_name, "package_info", cgal_package_name, "dependencies")
  return readlines(open(dependencies_file_path))
end

expand_deps(deps) = reduce(union, (Set(find_dependencies0(dep)) for dep in deps))

"""
dependencies of P contain P
"""
function find_dependencies(cgal_package_name)
  deps = Set([cgal_package_name])
  n = 0
  # iterate until fixed point
  while n != length(deps)
    n = length(deps)
    deps = expand_deps(deps)
  end
  return deps
end

for P in setdiff(find_dependencies("Intersections_3"), Set([]))
  #println("include dir for $P")
  Cxx.addHeaderDir(find_cgal_package_include_dir_path(P), kind=Cxx.C_System)
end

# to choose Geometry Kernel ??
geom_kernel_include_dir_path = joinpath(cgal_base_path, "Kernel_23/include")
#println("include dir for geometry kernel")
Cxx.addHeaderDir(geom_kernel_include_dir_path)

#println("")
Cxx.cxxinclude(joinpath(find_cgal_package_include_dir_path("Intersections_3"), "CGAL/Intersections_3/Triangle_3_Triangle_3.h"))


text:
# Example of extracting log file timing information and visualize them.

using Vlasiator, Dates, Plots

# plotly is nice for scanning through data interactively
plotly()

file = "logfile.txt"

timestamps, speed = readlog(file)

scatter(timestamps, speed,
   markershape=:circle,
   #yaxis=:log10,
   xlabel="Time", ylabel="Time per simulated second [s]")


text:
using Test
using Symbolics
using ForwardDiff
using LinearAlgebra
using BenchmarkTools
using IterativeLQR

include("objective.jl")
include("dynamics.jl")
include("constraints.jl")

include("acrobot.jl")
include("car.jl")


text:
include("../../arbitrary_f/temperature_render_approx.jl")

mass_vars = [10, 100, 10e6]
spin_vars = [0.0, 0.5, 0.998]
angle_vars = [15.0, 40.0, 85.0]
ϵ_3_vars = [-2, 2]

mass_fixed = 10
spin_fixed = 0.97
angle_fixed = 85.0

for ϵ_3 in ϵ_3_vars
    hmap, cache, title, new_img = temperature_render_approx(;
                                                    mass=mass_fixed,
                                                    spin=spin_fixed,
                                                    obs_angle=angle_fixed,
                                                    tolerance=1e-12,
                                                    dtmax=0.5,
                                                    size_multiplier=4,
                                                    resolution=3000,
                                                    ϵ_3=ϵ_3
                                                    )
    title!(title)
    png(hmap, "render_eps_3_approx=$ϵ_3.png")
end

for angle in angle_vars
    hmap, cache, title, new_img = temperature_render_approx(;
                                                    obs_angle=angle,
                                                    spin=spin_fixed,
                                                    mass=mass_fixed,
                                                    tolerance=1e-12,
                                                    dtmax=0.5,
                                                    size_multiplier=4,
                                                    resolution=3000
                                                    )
    title!(title)
    png(hmap, "render_angle_approx=$angle.png")
end