text:
#usegnum.jl creates a @bind_operation macro which binds unum and gnum operations
#to their respective operations depending on whether or not the :usegnum option
#is set.

doc"""
  `@bind_operation` uses julia's multiple dispatch capability to bind standard
  binary numerical operations to standard "word" functions.  For example, the
  macro:

    @bind_operation + add

  will generate functions mapping all relevant + combinations to the add_create
  function or the add! functions (which release gnums), if :use_gnum is specified,
  otherwise, mapping + to the simple "add" function
"""
macro bind_operation(op, fsymbol)
  gsymbol = Symbol(fsymbol, "!")
  gcreate = Symbol(fsymbol, "_create")
  if options[:usegnum]
    esc(quote
      @universal $op(a::Unum,   b::Unum)   = $gcreate(a, b)
      @universal $op(a::Unum,   b::Ubound) = $gcreate(a, b)
      @universal $op(a::Ubound, b::Unum)   = $gcreate(a, b)
      @universal $op(a::Ubound, b::Ubound) = $gcreate(a, b)

      @universal $op(a::Unum,   b::Gnum)   = $gsymbol(a, b)
      @universal $op(a::Ubound, b::Gnum)   = $gsymbol(a, b)
      @universal $op(a::Gnum,   b::Unum)   = $gsymbol(a, b)
      @universal $op(a::Gnum,   b::Ubound) = $gsymbol(a, b)
      @universal $op(a::Gnum,   b::Gnum)   = $gsymbol(a, b)
    end)
  else
    esc(quote
      @universal $op(a::Unum, b::Unum)     = $fsymbol(a, b)
      @universal $op(a::Unum, b::Ubound)   = $fsymbol(a, b)
      @universal $op(a::Ubound, b::Unum)   = $fsymbol(a, b)
      @universal $op(a::Ubound, b::Ubound) = $fsymbol(a, b)
    end)
  end
end

max_stars_repo_name: REX-Computing/unumjl

max_issues_repo_name: REX-Computing/unumjl

max_forks_repo_name: REX-Computing/unumjl


text:
# # dempe.mod	QQR2-MN-4-3
# # Original AMPL coding by Sven Leyffer
#
# # An MPEC from S. Dempe, "A necessary and sufficient optimality
# # condition for bilevel programming problems", Optimization 25,
# # pp. 341-354, 1992. From book Math. Progr. with Equil. Constr,
# # by Luo, Pang & Ralph, CUP, 1997, p. 354.
#
# # Number of variables:   2 + 1 multipliers
# # Number of constraints: 2
# # Nonlinear complementarity constraints
#
# var x;
# var z;
# var w >= 0;
#
# minimize f: (x - 3.5)^2 + (z + 4)^2;
#
# subject to
#     con1:  z - 3 + 2*z*w = 0;
#     con2:  0 >= z^2 - x     complements  w >= 0;
#
# data;
#
# # starting point
# let x := 1;
# let z := 1;
# let w := 1;
#
#
# let x :=   0.183193 ;
# let z := 0.428106;
# let w := 3.00379;

using JuMP, Complementarity
using Ipopt
using Test

@testset "dempe.jl" begin

    dempe = Model(with_optimizer(Ipopt.Optimizer))

    @variable(dempe, x)
    @variable(dempe, z)
    @variable(dempe, w>=0)

    @NLobjective(dempe, Min, (x - 3.5)^2 + (z + 4)^2)

    @NLconstraint(dempe, z - 3 + 2*z*w == 0)

    @complements(dempe, 0 >= z^2 - x,  w >= 0, simple)

    # Initial solutions to help reaching the optimality
    set_start_value(x, 0)
    set_start_value(z, 0)
    set_start_value(w, 1e7)

    # (xx, zz, ww) = (-3.999779029254958e-10, 9.852984581857451e-8, 1.5223813031201378e7)

    JuMP.optimize!(dempe)

    @show JuMP.objective_value(dempe)
    @test isapprox(JuMP.objective_value(dempe), 28.25, atol=1e-4)

    xx = JuMP.value(x)
    zz = JuMP.value(z)
    ww = JuMP.value(w)
    @test isapprox(zz - 3 + 2*zz*ww, 0, atol=1e-4)
end

ext: jl


text:
export project_bounds!

project_bounds!(v::Vector{T},minv::Union{Vector{T},T},maxv::Union{Vector{T},T}) where {T<:Real} = project_bounds!(v,minv,maxv,Array{T}(0))

function project_bounds!(v::Vector{T},minv::Union{Vector{T},T},maxv::Union{Vector{T},T},vproj::Vector{T}) where {T<:Real}
    if length(vproj)==0
        vproj = copy(v)
    else
        vproj .= v
    end
    @. vproj[vproj < minv] = minv
    @. vproj[vproj > maxv] = maxv
    return vproj
end


text:
module DASTDP

##### Exports

export STDP_fire
export LTP
export LTD
export DA_STDP_step
export synweight_step
export DA_inc
export time_reset
export M
export D
export Ni
export Ne
export N
export post
export pre

##### Constants

const M = 100
const D = 1
const Ne = 800
const Ni = 200
const N = Ne+Ni

post_tmp = vcat(rand(1:N,Ne,M),rand(1:Ne,Ni,M))

function initcon(N,M,post)
    delays = Array{Int64}[]
    pre = Array{CartesianIndex{2}}[]
    for i in 1:N
        delays = vcat(delays,[collect(1:M)])
        append!(pre,[collect([index for index in findall(x->x==i,post) if index[1]<=800])])
    end
    return pre,delays
end

pre_tmp ,delays_tmp= initcon(N,M,post_tmp)

const post = post_tmp
const pre = pre_tmp
const delays = delays_tmp

##### Functions

function STDP_fire(STDP::Array{Float64,2},fired::Array{Int64},msec::Int64,STDPinc::Float64=0.1) # Module DA_STDP
    if length(fired) != 0
        STDP[fired,msec+D] .= STDPinc
    end
    return STDP
end

function LTP(STDP::Array{Float64,2},sd::Array{Float64,2},fired::Array{Int64},msec::Int64,LTPinc::Float64=1.0)  # Module DA_STDP
    for index in eachindex(fired)
        pre_neurons = [pre[fired[index]][i][1] for i in eachindex(pre[fired[index]])]
        sd[pre[fired[index]]] .= sd[pre[fired[index]]] .+ LTPinc .* STDP[pre_neurons,msec]
    end
    return sd
end

function LTD(STDP::Array{Float64,2},sd::Array{Float64,2},s::Array{Float64,2},firings::Array{Int64,2},I::Array{Float64},msec::Int64,LTDinc::Float64=1.5) # Module DA_STDP
    last_ = length(firings[:,1])
    while firings[last_,1]>msec-D
        del = delays[firings[last_,2]]
        ind = post[firings[last_,2], del]
        I[ind] = I[ind] .+ s[firings[last_,2],del]
        sd[firings[last_,2],del] = sd[firings[last_,2],del] .- (LTDinc .* STDP[ind,msec+D])
        last_ = last_ - 1
    end
    return I,sd
end

function DA_STDP_step(STDP::Array{Float64,2},DA::Float64,msec::Int64) # Module DA_STDP
    STDP[:,msec+D+1] .= 0.95 .* STDP[:,msec+D]
    DA = DA*0.995
    return STDP,DA
end

function synweight_step(sd::Array{Float64,2},s::Array{Float64,2},DA::Float64,sm::Int64=4) # Module DA_STDP
    s[1:Ne,:] .= clamp.(s[1:Ne,:] .+ ((0.002+DA) .* sd[1:Ne,:]),0,sm)
    sd .= 0.99.*sd
    return s,sd
end

function DA_inc(rew::Array{Int64},DA::Float64,time::Int64,DAinc::Float64=0.5) # Module DA_STDP
    if time in rew
        DA += DAinc
    end
    return DA
end

function time_reset(STDP::Array{Float64,2},firings::Array{Int64,2}) # Module DA_STDP
    STDP[:,1:D+1]=STDP[:,1001:1001+D]
    ind = findall(x->x>1001-D,firings[:,1])
    firings = vcat([-D 0],hcat(firings[ind,1].-1000,firings[ind,2]))
    return STDP,firings
end

end #end of module

max_stars_repo_name: SuReLI/RL-STDP

max_issues_repo_name: SuReLI/RL-STDP

max_forks_repo_name: SuReLI/RL-STDP


text:
using ConstrainedDynamics

# Parameters
joint_axis = [1.0;0.0;0.0]

length1 = 0.5
width, depth = 0.5, 0.5
box1 = Box(width, depth, length1, length1, color = RGBA(1., 1., 0.))
box2 = Box(width, depth, length1, length1, color = RGBA(1., 0., 0.))

# Links
origin = Origin{Float64}()
link1 = Body(box1)
link2 = Body(box2)

# Constraints
joint1 = EqualityConstraint(OriginConnection(origin, link1))
joint2 = EqualityConstraint(OriginConnection(origin, link2))

links = [link1;link2]
constraints = [joint1;joint2]
shapes = [box1;box2]

mech = Mechanism(origin, links, constraints, g = -5., shapes = shapes)
setPosition!(mech,link1,x = [0.;1.;0.])
setPosition!(mech,link2,x = [0.;-1.;0.])
setVelocity!(mech,link1,v = [-5.;-5;5])
setVelocity!(mech,link2,v = [-2.5;2.5;5],ω = [2;4;10.])

simulate!(mech,save = true)
visualize!(mech)


text:
#==============================================================================#
# GuardDuty.jl
#
# This file is generated from:
# https://github.com/aws/aws-sdk-js/blob/master/apis/guardduty-2017-11-28.normal.json
#==============================================================================#

__precompile__()

module GuardDuty

using AWSCore

"""
    using AWSSDK.GuardDuty.accept_invitation
    accept_invitation([::AWSConfig], arguments::Dict)
    accept_invitation([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/master", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/master", detectorId=, <keyword arguments>)

# AcceptInvitation Operation

Accepts the invitation to be monitored by a master GuardDuty account.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty member account.

## `invitationId = ::String`
This value is used to validate the master account to the member account.

## `masterId = ::String`
The account ID of the master GuardDuty account whose invitation you're accepting.

# Returns

`AcceptInvitationResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/AcceptInvitation)
"""
@inline accept_invitation(aws::AWSConfig=default_aws_config(); args...) = accept_invitation(aws, args)

@inline accept_invitation(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/master", args)

@inline accept_invitation(args) = accept_invitation(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.archive_findings
    archive_findings([::AWSConfig], arguments::Dict)
    archive_findings([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/archive", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/archive", detectorId=, <keyword arguments>)

# ArchiveFindings Operation

Archives Amazon GuardDuty findings specified by the list of finding IDs.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service whose findings you want to archive.

## `findingIds = [::String, ...]`
IDs of the findings that you want to archive.

# Returns

`ArchiveFindingsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ArchiveFindings)
"""
@inline archive_findings(aws::AWSConfig=default_aws_config(); args...) = archive_findings(aws, args)

@inline archive_findings(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings/archive", args)

@inline archive_findings(args) = archive_findings(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.create_detector
    create_detector([::AWSConfig], arguments::Dict)
    create_detector([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector", <keyword arguments>)

# CreateDetector Operation

Creates a single Amazon GuardDuty detector. A detector is an object that represents the GuardDuty service. A detector must be created in order for GuardDuty to become operational.

# Arguments

## `enable = ::Bool`
A boolean value that specifies whether the detector is to be enabled.

# Returns

`CreateDetectorResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/CreateDetector)
"""
@inline create_detector(aws::AWSConfig=default_aws_config(); args...) = create_detector(aws, args)

@inline create_detector(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector", args)

@inline create_detector(args) = create_detector(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.create_filter
    create_filter([::AWSConfig], arguments::Dict)
    create_filter([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/filter", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/filter", detectorId=, <keyword arguments>)

# CreateFilter Operation

Creates a filter using the specified finding criteria.

# Arguments

## `action = "NOOP" or "ARCHIVE"`
Specifies the action that is to be applied to the findings that match the filter.

## `clientToken = ::String`
The idempotency token for the create request.

## `description = ::String`
The description of the filter.

## `detectorId = ::String` -- *Required*
The unique ID of the detector that you want to update.

## `findingCriteria = ["criterion" =>  ::Dict{String,String}]`
Represents the criteria to be used in the filter for querying findings.

## `name = ::String`
The name of the filter.

## `rank = ::Int`
Specifies the position of the filter in the list of current filters. Also specifies the order in which this filter is applied to the findings.

# Returns

`CreateFilterResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/CreateFilter)
"""
@inline create_filter(aws::AWSConfig=default_aws_config(); args...) = create_filter(aws, args)

@inline create_filter(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/filter", args)

@inline create_filter(args) = create_filter(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.create_ipset
    create_ipset([::AWSConfig], arguments::Dict)
    create_ipset([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/ipset", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/ipset", detectorId=, <keyword arguments>)

# CreateIPSet Operation

Creates a new IPSet - a list of trusted IP addresses that have been whitelisted for secure communication with AWS infrastructure and applications.

# Arguments

## `activate = ::Bool`
A boolean value that indicates whether GuardDuty is to start using the uploaded IPSet.

## `detectorId = ::String` -- *Required*
The unique ID of the detector that you want to update.

## `format = "TXT", "STIX", "OTX_CSV", "ALIEN_VAULT", "PROOF_POINT" or "FIRE_EYE"`
The format of the file that contains the IPSet.

## `location = ::String`
The URI of the file that contains the IPSet. For example (https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key)

## `name = ::String`
The user friendly name to identify the IPSet. This name is displayed in all findings that are triggered by activity that involves IP addresses included in this IPSet.

# Returns

`CreateIPSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/CreateIPSet)
"""
@inline create_ipset(aws::AWSConfig=default_aws_config(); args...) = create_ipset(aws, args)

@inline create_ipset(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/ipset", args)

@inline create_ipset(args) = create_ipset(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.create_members
    create_members([::AWSConfig], arguments::Dict)
    create_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member", detectorId=, <keyword arguments>)

# CreateMembers Operation

Creates member accounts of the current AWS account by specifying a list of AWS account IDs. The current AWS account can then invite these members to manage GuardDuty in their accounts.

# Arguments

## `accountDetails = [[ ... ], ...]`
A list of account ID and email address pairs of the accounts that you want to associate with the master GuardDuty account.
```
 accountDetails = [[
        "accountId" => <required> ::String,
        "email" => <required> ::String
    ], ...]
```

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account with which you want to associate member accounts.

# Returns

`CreateMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/CreateMembers)
"""
@inline create_members(aws::AWSConfig=default_aws_config(); args...) = create_members(aws, args)

@inline create_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member", args)

@inline create_members(args) = create_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.create_sample_findings
    create_sample_findings([::AWSConfig], arguments::Dict)
    create_sample_findings([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/create", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/create", detectorId=, <keyword arguments>)

# CreateSampleFindings Operation

Generates example findings of types specified by the list of finding types. If 'NULL' is specified for findingTypes, the API generates example findings of all supported finding types.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector to create sample findings for.

## `findingTypes = [::String, ...]`
Types of sample findings that you want to generate.

# Returns

`CreateSampleFindingsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/CreateSampleFindings)
"""
@inline create_sample_findings(aws::AWSConfig=default_aws_config(); args...) = create_sample_findings(aws, args)

@inline create_sample_findings(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings/create", args)

@inline create_sample_findings(args) = create_sample_findings(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.create_threat_intel_set
    create_threat_intel_set([::AWSConfig], arguments::Dict)
    create_threat_intel_set([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/threatintelset", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/threatintelset", detectorId=, <keyword arguments>)

# CreateThreatIntelSet Operation

Create a new ThreatIntelSet. ThreatIntelSets consist of known malicious IP addresses. GuardDuty generates findings based on ThreatIntelSets.

# Arguments

## `activate = ::Bool`
A boolean value that indicates whether GuardDuty is to start using the uploaded ThreatIntelSet.

## `detectorId = ::String` -- *Required*
The unique ID of the detector that you want to update.

## `format = "TXT", "STIX", "OTX_CSV", "ALIEN_VAULT", "PROOF_POINT" or "FIRE_EYE"`
The format of the file that contains the ThreatIntelSet.

## `location = ::String`
The URI of the file that contains the ThreatIntelSet. For example (https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key).

## `name = ::String`
A user-friendly ThreatIntelSet name that is displayed in all finding generated by activity that involves IP addresses included in this ThreatIntelSet.

# Returns

`CreateThreatIntelSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/CreateThreatIntelSet)
"""
@inline create_threat_intel_set(aws::AWSConfig=default_aws_config(); args...) = create_threat_intel_set(aws, args)

@inline create_threat_intel_set(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/threatintelset", args)

@inline create_threat_intel_set(args) = create_threat_intel_set(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.decline_invitations
    decline_invitations([::AWSConfig], arguments::Dict)
    decline_invitations([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/invitation/decline", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/invitation/decline", <keyword arguments>)

# DeclineInvitations Operation

Declines invitations sent to the current member account by AWS account specified by their account IDs.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the AWS accounts that sent invitations to the current member account that you want to decline invitations from.

# Returns

`DeclineInvitationsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeclineInvitations)
"""
@inline decline_invitations(aws::AWSConfig=default_aws_config(); args...) = decline_invitations(aws, args)

@inline decline_invitations(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/invitation/decline", args)

@inline decline_invitations(args) = decline_invitations(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.delete_detector
    delete_detector([::AWSConfig], arguments::Dict)
    delete_detector([::AWSConfig]; detectorId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}", arguments::Dict)
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}", detectorId=)

# DeleteDetector Operation

Deletes a Amazon GuardDuty detector specified by the detector ID.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID that specifies the detector that you want to delete.

# Returns

`DeleteDetectorResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeleteDetector)
"""
@inline delete_detector(aws::AWSConfig=default_aws_config(); args...) = delete_detector(aws, args)

@inline delete_detector(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "DELETE", "/detector/{detectorId}", args)

@inline delete_detector(args) = delete_detector(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.delete_filter
    delete_filter([::AWSConfig], arguments::Dict)
    delete_filter([::AWSConfig]; detectorId=, filterName=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}/filter/{filterName}", arguments::Dict)
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}/filter/{filterName}", detectorId=, filterName=)

# DeleteFilter Operation

Deletes the filter specified by the filter name.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID that specifies the detector where you want to delete a filter.

## `filterName = ::String` -- *Required*
The name of the filter.

# Returns

`DeleteFilterResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeleteFilter)
"""
@inline delete_filter(aws::AWSConfig=default_aws_config(); args...) = delete_filter(aws, args)

@inline delete_filter(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "DELETE", "/detector/{detectorId}/filter/{filterName}", args)

@inline delete_filter(args) = delete_filter(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.delete_ipset
    delete_ipset([::AWSConfig], arguments::Dict)
    delete_ipset([::AWSConfig]; detectorId=, ipSetId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}/ipset/{ipSetId}", arguments::Dict)
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}/ipset/{ipSetId}", detectorId=, ipSetId=)

# DeleteIPSet Operation

Deletes the IPSet specified by the IPSet ID.

# Arguments

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose IPSet you want to delete.

## `ipSetId = ::String` -- *Required*
The unique ID that specifies the IPSet that you want to delete.

# Returns

`DeleteIPSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeleteIPSet)
"""
@inline delete_ipset(aws::AWSConfig=default_aws_config(); args...) = delete_ipset(aws, args)

@inline delete_ipset(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "DELETE", "/detector/{detectorId}/ipset/{ipSetId}", args)

@inline delete_ipset(args) = delete_ipset(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.delete_invitations
    delete_invitations([::AWSConfig], arguments::Dict)
    delete_invitations([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/invitation/delete", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/invitation/delete", <keyword arguments>)

# DeleteInvitations Operation

Deletes invitations sent to the current member account by AWS accounts specified by their account IDs.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the AWS accounts that sent invitations to the current member account that you want to delete invitations from.

# Returns

`DeleteInvitationsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeleteInvitations)
"""
@inline delete_invitations(aws::AWSConfig=default_aws_config(); args...) = delete_invitations(aws, args)

@inline delete_invitations(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/invitation/delete", args)

@inline delete_invitations(args) = delete_invitations(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.delete_members
    delete_members([::AWSConfig], arguments::Dict)
    delete_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/delete", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/delete", detectorId=, <keyword arguments>)

# DeleteMembers Operation

Deletes GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the GuardDuty member accounts that you want to delete.

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account whose members you want to delete.

# Returns

`DeleteMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeleteMembers)
"""
@inline delete_members(aws::AWSConfig=default_aws_config(); args...) = delete_members(aws, args)

@inline delete_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member/delete", args)

@inline delete_members(args) = delete_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.delete_threat_intel_set
    delete_threat_intel_set([::AWSConfig], arguments::Dict)
    delete_threat_intel_set([::AWSConfig]; detectorId=, threatIntelSetId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", arguments::Dict)
    guardduty([::AWSConfig], "DELETE", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", detectorId=, threatIntelSetId=)

# DeleteThreatIntelSet Operation

Deletes ThreatIntelSet specified by the ThreatIntelSet ID.

# Arguments

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose ThreatIntelSet you want to delete.

## `threatIntelSetId = ::String` -- *Required*
The unique ID that specifies the ThreatIntelSet that you want to delete.

# Returns

`DeleteThreatIntelSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DeleteThreatIntelSet)
"""
@inline delete_threat_intel_set(aws::AWSConfig=default_aws_config(); args...) = delete_threat_intel_set(aws, args)

@inline delete_threat_intel_set(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "DELETE", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", args)

@inline delete_threat_intel_set(args) = delete_threat_intel_set(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.disassociate_from_master_account
    disassociate_from_master_account([::AWSConfig], arguments::Dict)
    disassociate_from_master_account([::AWSConfig]; detectorId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/master/disassociate", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/master/disassociate", detectorId=)

# DisassociateFromMasterAccount Operation

Disassociates the current GuardDuty member account from its master account.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty member account.

# Returns

`DisassociateFromMasterAccountResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DisassociateFromMasterAccount)
"""
@inline disassociate_from_master_account(aws::AWSConfig=default_aws_config(); args...) = disassociate_from_master_account(aws, args)

@inline disassociate_from_master_account(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/master/disassociate", args)

@inline disassociate_from_master_account(args) = disassociate_from_master_account(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.disassociate_members
    disassociate_members([::AWSConfig], arguments::Dict)
    disassociate_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/disassociate", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/disassociate", detectorId=, <keyword arguments>)

# DisassociateMembers Operation

Disassociates GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the GuardDuty member accounts that you want to disassociate from master.

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account whose members you want to disassociate from master.

# Returns

`DisassociateMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/DisassociateMembers)
"""
@inline disassociate_members(aws::AWSConfig=default_aws_config(); args...) = disassociate_members(aws, args)

@inline disassociate_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member/disassociate", args)

@inline disassociate_members(args) = disassociate_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_detector
    get_detector([::AWSConfig], arguments::Dict)
    get_detector([::AWSConfig]; detectorId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}", detectorId=)

# GetDetector Operation

Retrieves an Amazon GuardDuty detector specified by the detectorId.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector that you want to retrieve.

# Returns

`GetDetectorResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetDetector)
"""
@inline get_detector(aws::AWSConfig=default_aws_config(); args...) = get_detector(aws, args)

@inline get_detector(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}", args)

@inline get_detector(args) = get_detector(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_filter
    get_filter([::AWSConfig], arguments::Dict)
    get_filter([::AWSConfig]; detectorId=, filterName=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/filter/{filterName}", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/filter/{filterName}", detectorId=, filterName=)

# GetFilter Operation

Returns the details of the filter specified by the filter name.

# Arguments

## `detectorId = ::String` -- *Required*
The detector ID that specifies the GuardDuty service where you want to list the details of the specified filter.

## `filterName = ::String` -- *Required*
The name of the filter whose details you want to get.

# Returns

`GetFilterResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetFilter)
"""
@inline get_filter(aws::AWSConfig=default_aws_config(); args...) = get_filter(aws, args)

@inline get_filter(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/filter/{filterName}", args)

@inline get_filter(args) = get_filter(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_findings
    get_findings([::AWSConfig], arguments::Dict)
    get_findings([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/get", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/get", detectorId=, <keyword arguments>)

# GetFindings Operation

Describes Amazon GuardDuty findings specified by finding IDs.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service whose findings you want to retrieve.

## `findingIds = [::String, ...]`
IDs of the findings that you want to retrieve.

## `sortCriteria = [ ... ]`
Represents the criteria used for sorting findings.
```
 sortCriteria = [
        "attributeName" =>  ::String,
        "orderBy" =>  "ASC" or "DESC"
    ]
```

# Returns

`GetFindingsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetFindings)
"""
@inline get_findings(aws::AWSConfig=default_aws_config(); args...) = get_findings(aws, args)

@inline get_findings(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings/get", args)

@inline get_findings(args) = get_findings(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_findings_statistics
    get_findings_statistics([::AWSConfig], arguments::Dict)
    get_findings_statistics([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/statistics", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/statistics", detectorId=, <keyword arguments>)

# GetFindingsStatistics Operation

Lists Amazon GuardDuty findings' statistics for the specified detector ID.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service whose findings' statistics you want to retrieve.

## `findingCriteria = ["criterion" =>  ::Dict{String,String}]`
Represents the criteria used for querying findings.

## `findingStatisticTypes = ["COUNT_BY_SEVERITY", ...]`
Types of finding statistics to retrieve.

# Returns

`GetFindingsStatisticsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetFindingsStatistics)
"""
@inline get_findings_statistics(aws::AWSConfig=default_aws_config(); args...) = get_findings_statistics(aws, args)

@inline get_findings_statistics(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings/statistics", args)

@inline get_findings_statistics(args) = get_findings_statistics(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_ipset
    get_ipset([::AWSConfig], arguments::Dict)
    get_ipset([::AWSConfig]; detectorId=, ipSetId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/ipset/{ipSetId}", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/ipset/{ipSetId}", detectorId=, ipSetId=)

# GetIPSet Operation

Retrieves the IPSet specified by the IPSet ID.

# Arguments

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose IPSet you want to retrieve.

## `ipSetId = ::String` -- *Required*
The unique ID that specifies the IPSet that you want to describe.

# Returns

`GetIPSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetIPSet)
"""
@inline get_ipset(aws::AWSConfig=default_aws_config(); args...) = get_ipset(aws, args)

@inline get_ipset(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/ipset/{ipSetId}", args)

@inline get_ipset(args) = get_ipset(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_invitations_count
    get_invitations_count([::AWSConfig], arguments::Dict)
    get_invitations_count([::AWSConfig]; )

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/invitation/count", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/invitation/count", )

# GetInvitationsCount Operation

Returns the count of all GuardDuty membership invitations that were sent to the current member account except the currently accepted invitation.

# Arguments

# Returns

`GetInvitationsCountResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetInvitationsCount)
"""
@inline get_invitations_count(aws::AWSConfig=default_aws_config(); args...) = get_invitations_count(aws, args)

@inline get_invitations_count(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/invitation/count", args)

@inline get_invitations_count(args) = get_invitations_count(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_master_account
    get_master_account([::AWSConfig], arguments::Dict)
    get_master_account([::AWSConfig]; detectorId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/master", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/master", detectorId=)

# GetMasterAccount Operation

Provides the details for the GuardDuty master account to the current GuardDuty member account.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty member account.

# Returns

`GetMasterAccountResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetMasterAccount)
"""
@inline get_master_account(aws::AWSConfig=default_aws_config(); args...) = get_master_account(aws, args)

@inline get_master_account(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/master", args)

@inline get_master_account(args) = get_master_account(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_members
    get_members([::AWSConfig], arguments::Dict)
    get_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/get", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/get", detectorId=, <keyword arguments>)

# GetMembers Operation

Retrieves GuardDuty member accounts (to the current GuardDuty master account) specified by the account IDs.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the GuardDuty member accounts that you want to describe.

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account whose members you want to retrieve.

# Returns

`GetMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetMembers)
"""
@inline get_members(aws::AWSConfig=default_aws_config(); args...) = get_members(aws, args)

@inline get_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member/get", args)

@inline get_members(args) = get_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.get_threat_intel_set
    get_threat_intel_set([::AWSConfig], arguments::Dict)
    get_threat_intel_set([::AWSConfig]; detectorId=, threatIntelSetId=)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", detectorId=, threatIntelSetId=)

# GetThreatIntelSet Operation

Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID.

# Arguments

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose ThreatIntelSet you want to describe.

## `threatIntelSetId = ::String` -- *Required*
The unique ID that specifies the ThreatIntelSet that you want to describe.

# Returns

`GetThreatIntelSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/GetThreatIntelSet)
"""
@inline get_threat_intel_set(aws::AWSConfig=default_aws_config(); args...) = get_threat_intel_set(aws, args)

@inline get_threat_intel_set(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", args)

@inline get_threat_intel_set(args) = get_threat_intel_set(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.invite_members
    invite_members([::AWSConfig], arguments::Dict)
    invite_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/invite", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/invite", detectorId=, <keyword arguments>)

# InviteMembers Operation

Invites other AWS accounts (created as members of the current AWS account by CreateMembers) to enable GuardDuty and allow the current AWS account to view and manage these accounts' GuardDuty findings on their behalf as the master account.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the accounts that you want to invite to GuardDuty as members.

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account with which you want to invite members.

## `disableEmailNotification = ::Bool`
A boolean value that specifies whether you want to disable email notification to the accounts that you’re inviting to GuardDuty as members.

## `message = ::String`
The invitation message that you want to send to the accounts that you’re inviting to GuardDuty as members.

# Returns

`InviteMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/InviteMembers)
"""
@inline invite_members(aws::AWSConfig=default_aws_config(); args...) = invite_members(aws, args)

@inline invite_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member/invite", args)

@inline invite_members(args) = invite_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_detectors
    list_detectors([::AWSConfig], arguments::Dict)
    list_detectors([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector", <keyword arguments>)

# ListDetectors Operation

Lists detectorIds of all the existing Amazon GuardDuty detector resources.

# Arguments

## `maxResults = ::Int`
You can use this parameter to indicate the maximum number of detectors that you want in the response.

## `nextToken = ::String`
You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListDetectors action. For subsequent calls to the action fill nextToken in the request with the value of nextToken from the previous response to continue listing data.

# Returns

`ListDetectorsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListDetectors)
"""
@inline list_detectors(aws::AWSConfig=default_aws_config(); args...) = list_detectors(aws, args)

@inline list_detectors(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector", args)

@inline list_detectors(args) = list_detectors(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_filters
    list_filters([::AWSConfig], arguments::Dict)
    list_filters([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/filter", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/filter", detectorId=, <keyword arguments>)

# ListFilters Operation

Returns a paginated list of the current filters.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service where you want to list filters.

## `maxResults = ::Int`
Indicates the maximum number of items that you want in the response. The maximum value is 50.

## `nextToken = ::String`
Paginates results. Set the value of this parameter to NULL on your first call to the ListFilters operation.For subsequent calls to the operation, fill nextToken in the request with the value of nextToken from the previous response to continue listing data.

# Returns

`ListFiltersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListFilters)
"""
@inline list_filters(aws::AWSConfig=default_aws_config(); args...) = list_filters(aws, args)

@inline list_filters(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/filter", args)

@inline list_filters(args) = list_filters(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_findings
    list_findings([::AWSConfig], arguments::Dict)
    list_findings([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings", detectorId=, <keyword arguments>)

# ListFindings Operation

Lists Amazon GuardDuty findings for the specified detector ID.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service whose findings you want to list.

## `findingCriteria = ["criterion" =>  ::Dict{String,String}]`
Represents the criteria used for querying findings.

## `maxResults = ::Int`
You can use this parameter to indicate the maximum number of items you want in the response. The default value is 50. The maximum value is 50.

## `nextToken = ::String`
You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListFindings action. For subsequent calls to the action fill nextToken in the request with the value of nextToken from the previous response to continue listing data.

## `sortCriteria = [ ... ]`
Represents the criteria used for sorting findings.
```
 sortCriteria = [
        "attributeName" =>  ::String,
        "orderBy" =>  "ASC" or "DESC"
    ]
```

# Returns

`ListFindingsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListFindings)
"""
@inline list_findings(aws::AWSConfig=default_aws_config(); args...) = list_findings(aws, args)

@inline list_findings(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings", args)

@inline list_findings(args) = list_findings(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_ipsets
    list_ipsets([::AWSConfig], arguments::Dict)
    list_ipsets([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/ipset", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/ipset", detectorId=, <keyword arguments>)

# ListIPSets Operation

Lists the IPSets of the GuardDuty service specified by the detector ID.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector that you want to retrieve.

## `maxResults = ::Int`
You can use this parameter to indicate the maximum number of items that you want in the response. The default value is 7. The maximum value is 7.

## `nextToken = ::String`
You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListIPSet action. For subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

# Returns

`ListIPSetsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListIPSets)
"""
@inline list_ipsets(aws::AWSConfig=default_aws_config(); args...) = list_ipsets(aws, args)

@inline list_ipsets(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/ipset", args)

@inline list_ipsets(args) = list_ipsets(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_invitations
    list_invitations([::AWSConfig], arguments::Dict)
    list_invitations([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/invitation", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/invitation", <keyword arguments>)

# ListInvitations Operation

Lists all GuardDuty membership invitations that were sent to the current AWS account.

# Arguments

## `maxResults = ::Int`
You can use this parameter to indicate the maximum number of invitations you want in the response. The default value is 50. The maximum value is 50.

## `nextToken = ::String`
You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListInvitations action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

# Returns

`ListInvitationsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListInvitations)
"""
@inline list_invitations(aws::AWSConfig=default_aws_config(); args...) = list_invitations(aws, args)

@inline list_invitations(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/invitation", args)

@inline list_invitations(args) = list_invitations(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_members
    list_members([::AWSConfig], arguments::Dict)
    list_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/member", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/member", detectorId=, <keyword arguments>)

# ListMembers Operation

Lists details about all member accounts for the current GuardDuty master account.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account whose members you want to list.

## `maxResults = ::Int`
You can use this parameter to indicate the maximum number of items you want in the response. The default value is 1. The maximum value is 50.

## `nextToken = ::String`
You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListMembers action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

## `onlyAssociated = ::String`
Specifies what member accounts the response is to include based on their relationship status with the master account. The default value is TRUE. If onlyAssociated is set to TRUE, the response will include member accounts whose relationship status with the master is set to Enabled, Disabled. If onlyAssociated is set to FALSE, the response will include all existing member accounts.

# Returns

`ListMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListMembers)
"""
@inline list_members(aws::AWSConfig=default_aws_config(); args...) = list_members(aws, args)

@inline list_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/member", args)

@inline list_members(args) = list_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.list_threat_intel_sets
    list_threat_intel_sets([::AWSConfig], arguments::Dict)
    list_threat_intel_sets([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/threatintelset", arguments::Dict)
    guardduty([::AWSConfig], "GET", "/detector/{detectorId}/threatintelset", detectorId=, <keyword arguments>)

# ListThreatIntelSets Operation

Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID.

# Arguments

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose ThreatIntelSets you want to list.

## `maxResults = ::Int`
You can use this parameter to indicate the maximum number of items that you want in the response. The default value is 7. The maximum value is 7.

## `nextToken = ::String`
Pagination token to start retrieving threat intel sets from.

# Returns

`ListThreatIntelSetsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/ListThreatIntelSets)
"""
@inline list_threat_intel_sets(aws::AWSConfig=default_aws_config(); args...) = list_threat_intel_sets(aws, args)

@inline list_threat_intel_sets(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "GET", "/detector/{detectorId}/threatintelset", args)

@inline list_threat_intel_sets(args) = list_threat_intel_sets(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.start_monitoring_members
    start_monitoring_members([::AWSConfig], arguments::Dict)
    start_monitoring_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/start", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/start", detectorId=, <keyword arguments>)

# StartMonitoringMembers Operation

Re-enables GuardDuty to monitor findings of the member accounts specified by the account IDs. A master GuardDuty account can run this command after disabling GuardDuty from monitoring these members' findings by running StopMonitoringMembers.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the GuardDuty member accounts whose findings you want the master account to monitor.

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account whom you want to re-enable to monitor members' findings.

# Returns

`StartMonitoringMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/StartMonitoringMembers)
"""
@inline start_monitoring_members(aws::AWSConfig=default_aws_config(); args...) = start_monitoring_members(aws, args)

@inline start_monitoring_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member/start", args)

@inline start_monitoring_members(args) = start_monitoring_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.stop_monitoring_members
    stop_monitoring_members([::AWSConfig], arguments::Dict)
    stop_monitoring_members([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/stop", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/member/stop", detectorId=, <keyword arguments>)

# StopMonitoringMembers Operation

Disables GuardDuty from monitoring findings of the member accounts specified by the account IDs. After running this command, a master GuardDuty account can run StartMonitoringMembers to re-enable GuardDuty to monitor these members’ findings.

# Arguments

## `accountIds = [::String, ...]`
A list of account IDs of the GuardDuty member accounts whose findings you want the master account to stop monitoring.

## `detectorId = ::String` -- *Required*
The unique ID of the detector of the GuardDuty account that you want to stop from monitor members' findings.

# Returns

`StopMonitoringMembersResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/StopMonitoringMembers)
"""
@inline stop_monitoring_members(aws::AWSConfig=default_aws_config(); args...) = stop_monitoring_members(aws, args)

@inline stop_monitoring_members(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/member/stop", args)

@inline stop_monitoring_members(args) = stop_monitoring_members(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.unarchive_findings
    unarchive_findings([::AWSConfig], arguments::Dict)
    unarchive_findings([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/unarchive", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/unarchive", detectorId=, <keyword arguments>)

# UnarchiveFindings Operation

Unarchives Amazon GuardDuty findings specified by the list of finding IDs.

# Arguments

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service whose findings you want to unarchive.

## `findingIds = [::String, ...]`
IDs of the findings that you want to unarchive.

# Returns

`UnarchiveFindingsResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/UnarchiveFindings)
"""
@inline unarchive_findings(aws::AWSConfig=default_aws_config(); args...) = unarchive_findings(aws, args)

@inline unarchive_findings(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings/unarchive", args)

@inline unarchive_findings(args) = unarchive_findings(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.update_detector
    update_detector([::AWSConfig], arguments::Dict)
    update_detector([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}", detectorId=, <keyword arguments>)

# UpdateDetector Operation

Updates an Amazon GuardDuty detector specified by the detectorId.

# Arguments

## `detectorId = ::String` -- *Required*
The unique ID of the detector that you want to update.

## `enable = ::Bool`
Updated boolean value for the detector that specifies whether the detector is enabled.

# Returns

`UpdateDetectorResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/UpdateDetector)
"""
@inline update_detector(aws::AWSConfig=default_aws_config(); args...) = update_detector(aws, args)

@inline update_detector(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}", args)

@inline update_detector(args) = update_detector(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.update_filter
    update_filter([::AWSConfig], arguments::Dict)
    update_filter([::AWSConfig]; detectorId=, filterName=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/filter/{filterName}", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/filter/{filterName}", detectorId=, filterName=, <keyword arguments>)

# UpdateFilter Operation

Updates the filter specified by the filter name.

# Arguments

## `action = "NOOP" or "ARCHIVE"`
Specifies the action that is to be applied to the findings that match the filter.

## `description = ::String`
The description of the filter.

## `detectorId = ::String` -- *Required*
The unique ID of the detector that specifies the GuardDuty service where you want to update a filter.

## `filterName = ::String` -- *Required*
The name of the filter.

## `findingCriteria = ["criterion" =>  ::Dict{String,String}]`
Represents the criteria to be used in the filter for querying findings.

## `rank = ::Int`
Specifies the position of the filter in the list of current filters. Also specifies the order in which this filter is applied to the findings.

# Returns

`UpdateFilterResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/UpdateFilter)
"""
@inline update_filter(aws::AWSConfig=default_aws_config(); args...) = update_filter(aws, args)

@inline update_filter(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/filter/{filterName}", args)

@inline update_filter(args) = update_filter(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.update_findings_feedback
    update_findings_feedback([::AWSConfig], arguments::Dict)
    update_findings_feedback([::AWSConfig]; detectorId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/feedback", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/findings/feedback", detectorId=, <keyword arguments>)

# UpdateFindingsFeedback Operation

Marks specified Amazon GuardDuty findings as useful or not useful.

# Arguments

## `comments = ::String`
Additional feedback about the GuardDuty findings.

## `detectorId = ::String` -- *Required*
The ID of the detector that specifies the GuardDuty service whose findings you want to mark as useful or not useful.

## `feedback = "USEFUL" or "NOT_USEFUL"`
Valid values: USEFUL | NOT_USEFUL

## `findingIds = [::String, ...]`
IDs of the findings that you want to mark as useful or not useful.

# Returns

`UpdateFindingsFeedbackResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/UpdateFindingsFeedback)
"""
@inline update_findings_feedback(aws::AWSConfig=default_aws_config(); args...) = update_findings_feedback(aws, args)

@inline update_findings_feedback(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/findings/feedback", args)

@inline update_findings_feedback(args) = update_findings_feedback(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.update_ipset
    update_ipset([::AWSConfig], arguments::Dict)
    update_ipset([::AWSConfig]; detectorId=, ipSetId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/ipset/{ipSetId}", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/ipset/{ipSetId}", detectorId=, ipSetId=, <keyword arguments>)

# UpdateIPSet Operation

Updates the IPSet specified by the IPSet ID.

# Arguments

## `activate = ::Bool`
The updated boolean value that specifies whether the IPSet is active or not.

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose IPSet you want to update.

## `ipSetId = ::String` -- *Required*
The unique ID that specifies the IPSet that you want to update.

## `location = ::String`
The updated URI of the file that contains the IPSet. For example (https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key).

## `name = ::String`
The unique ID that specifies the IPSet that you want to update.

# Returns

`UpdateIPSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/UpdateIPSet)
"""
@inline update_ipset(aws::AWSConfig=default_aws_config(); args...) = update_ipset(aws, args)

@inline update_ipset(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/ipset/{ipSetId}", args)

@inline update_ipset(args) = update_ipset(default_aws_config(), args)

"""
    using AWSSDK.GuardDuty.update_threat_intel_set
    update_threat_intel_set([::AWSConfig], arguments::Dict)
    update_threat_intel_set([::AWSConfig]; detectorId=, threatIntelSetId=, <keyword arguments>)

    using AWSCore.Services.guardduty
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", arguments::Dict)
    guardduty([::AWSConfig], "POST", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", detectorId=, threatIntelSetId=, <keyword arguments>)

# UpdateThreatIntelSet Operation

Updates the ThreatIntelSet specified by ThreatIntelSet ID.

# Arguments

## `activate = ::Bool`
The updated boolean value that specifies whether the ThreateIntelSet is active or not.

## `detectorId = ::String` -- *Required*
The detectorID that specifies the GuardDuty service whose ThreatIntelSet you want to update.

## `location = ::String`
The updated URI of the file that contains the ThreateIntelSet. For example (https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key)

## `name = ::String`
The unique ID that specifies the ThreatIntelSet that you want to update.

## `threatIntelSetId = ::String` -- *Required*
The unique ID that specifies the ThreatIntelSet that you want to update.

# Returns

`UpdateThreatIntelSetResponse`

# Exceptions

`BadRequestException` or `InternalServerErrorException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/guardduty-2017-11-28/UpdateThreatIntelSet)
"""
@inline update_threat_intel_set(aws::AWSConfig=default_aws_config(); args...) = update_threat_intel_set(aws, args)

@inline update_threat_intel_set(aws::AWSConfig, args) = AWSCore.Services.guardduty(aws, "POST", "/detector/{detectorId}/threatintelset/{threatIntelSetId}", args)

@inline update_threat_intel_set(args) = update_threat_intel_set(default_aws_config(), args)

end # module GuardDuty

#==============================================================================#
# End of file
#==============================================================================#


text:
abstract type MixedModelFitCollection{T<:AbstractFloat} end # model with fixed and random effects

"""
    MixedModelBootstrap{T<:AbstractFloat} <: MixedModelFitCollection{T}

Object returned by `parametericbootstrap` with fields
- `fits`: the parameter estimates from the bootstrap replicates as a vector of named tuples.
- `λ`: `Vector{LowerTriangular{T,Matrix{T}}}` containing copies of the λ field from `ReMat` model terms
- `inds`: `Vector{Vector{Int}}` containing copies of the `inds` field from `ReMat` model terms
- `lowerbd`: `Vector{T}` containing the vector of lower bounds (corresponds to the identically named field of [`OptSummary`](@ref))
- `fcnames`: NamedTuple whose keys are the grouping factor names and whose values are the column names

The schema of `fits` is, by default,
```
Tables.Schema:
 :objective  T
 :σ          T
 :β          NamedTuple{β_names}{NTuple{p,T}}
 :se         StaticArrays.SArray{Tuple{p},T,1,p}
 :θ          StaticArrays.SArray{Tuple{k},T,1,k}
```
where the sizes, `p` and `k`, of the `β` and `θ` elements are determined by the model.

Characteristics of the bootstrap replicates can be extracted as properties.  The `σs` and
`σρs` properties unravel the `σ` and `θ` estimates into estimates of the standard deviations
and correlations of the random-effects terms.
"""
struct MixedModelBootstrap{T<:AbstractFloat} <: MixedModelFitCollection{T}
    fits::Vector
    λ::Vector{Union{LowerTriangular{T},Diagonal{T}}}
    inds::Vector{Vector{Int}}
    lowerbd::Vector{T}
    fcnames::NamedTuple
end

"""
    parametricbootstrap([rng::AbstractRNG], nsamp::Integer, m::MixedModel{T}, ftype=T;
        β = coef(m), σ = m.σ, θ = m.θ, use_threads=false, hide_progress=false)

Perform `nsamp` parametric bootstrap replication fits of `m`, returning a `MixedModelBootstrap`.

The default random number generator is `Random.GLOBAL_RNG`.

`ftype` can be used to store the computed bootstrap values in a lower precision. `ftype` is
not a named argument because named arguments are not used in method dispatch and thus
specialization. In other words, having `ftype` as a positional argument has some potential
performance benefits.

# Named Arguments

- `β`, `σ`, and `θ` are the values of `m`'s parameters for simulating the responses.
- `σ` is only valid for `LinearMixedModel` and `GeneralizedLinearMixedModel` for
families with a dispersion parameter.
- `use_threads` determines whether or not to use thread-based parallelism.
- `hide_progress` can be used to disable the progress bar. Note that the progress
bar is automatically disabled for non-interactive (i.e. logging) contexts.

!!! note
    Note that `use_threads=true` may not offer a performance boost and may even
    decrease peformance if multithreaded linear algebra (BLAS) routines are available.
    In this case, threads at the level of the linear algebra may already occupy all
    processors/processor cores. There are plans to provide better support in coordinating
    Julia- and BLAS-level threads in the future.

!!! warning
    The PRNG shared between threads is locked using `Threads.SpinLock`, which
    should not be used recursively. Do not wrap `parametricbootstrap` in an outer `SpinLock`.
"""
function parametricbootstrap(
    rng::AbstractRNG,
    n::Integer,
    morig::MixedModel{T},
    ftype::Type{<:AbstractFloat}=T;
    β::AbstractVector=coef(morig),
    σ=morig.σ,
    θ::AbstractVector=morig.θ,
    use_threads::Bool=false,
    hide_progress::Bool=false,
) where {T}
    if σ !== missing
        σ = T(σ)
    end
    β, θ = convert(Vector{T}, β), convert(Vector{T}, θ)
    βsc, θsc = similar(ftype.(β)), similar(ftype.(θ))
    p, k = length(β), length(θ)
    m = deepcopy(morig)

    β_names = (Symbol.(fixefnames(morig))...,)

    # we need arrays of these for in-place operations to work across threads
    m_threads = [m]
    βsc_threads = [βsc]
    θsc_threads = [θsc]

    if use_threads
        Threads.resize_nthreads!(m_threads)
        Threads.resize_nthreads!(βsc_threads)
        Threads.resize_nthreads!(θsc_threads)
    end
    # we use locks to guarantee thread-safety, but there might be better ways to do this for some RNGs
    # see https://docs.julialang.org/en/v1.3/manual/parallel-computing/#Side-effects-and-mutable-function-arguments-1
    # see https://docs.julialang.org/en/v1/stdlib/Future/index.html
    rnglock = Threads.SpinLock()
    samp = replicate(n; use_threads=use_threads, hide_progress=hide_progress) do
        tidx = use_threads ? Threads.threadid() : 1
        mod = m_threads[tidx]
        local βsc = βsc_threads[tidx]
        local θsc = θsc_threads[tidx]
        lock(rnglock)
        mod = simulate!(rng, mod; β=β, σ=σ, θ=θ)
        unlock(rnglock)
        refit!(mod; progress=false)
        (
            objective=ftype.(mod.objective),
            σ=ismissing(mod.σ) ? missing : ftype(mod.σ),
            β=NamedTuple{β_names}(fixef!(βsc, mod)),
            se=SVector{p,ftype}(stderror!(βsc, mod)),
            θ=SVector{k,ftype}(getθ!(θsc, mod)),
        )
    end
    return MixedModelBootstrap{ftype}(
        samp,
        map(vv -> ftype.(vv), morig.λ), # also does a deepcopy if no type conversion is necessary
        getfield.(morig.reterms, :inds),
        ftype.(morig.optsum.lowerbd[1:length(first(samp).θ)]),
        NamedTuple{Symbol.(fnames(morig))}(map(t -> (t.cnames...,), morig.reterms)),
    )
end

function parametricbootstrap(nsamp::Integer, m::MixedModel, args...; kwargs...)
    return parametricbootstrap(Random.GLOBAL_RNG, nsamp, m, args...; kwargs...)
end

"""
    allpars(bsamp::MixedModelFitCollection)

Return a tidy (column)table with the parameter estimates spread into columns
of `iter`, `type`, `group`, `name` and `value`.

!!! warning
    Currently, correlations that are systematically zero are included in the
    the result. This may change in a future release without being considered
    a breaking change.
"""
function allpars(bsamp::MixedModelFitCollection{T}) where {T}
    fits, λ, fcnames = bsamp.fits, bsamp.λ, bsamp.fcnames
    npars = 2 + length(first(fits).β) + sum(map(k -> (k * (k + 1)) >> 1, size.(bsamp.λ, 2)))
    nresrow = length(fits) * npars
    cols = (
        sizehint!(Int[], nresrow),
        sizehint!(String[], nresrow),
        sizehint!(Union{Missing,String}[], nresrow),
        sizehint!(Union{Missing,String}[], nresrow),
        sizehint!(T[], nresrow),
    )
    nrmdr = Vector{T}[]  # normalized rows of λ
    for (i, r) in enumerate(fits)
        σ = coalesce(r.σ, one(T))
        for (nm, v) in pairs(r.β)
            push!.(cols, (i, "β", missing, String(nm), v))
        end
        setθ!(bsamp, i)
        for (grp, ll) in zip(keys(fcnames), λ)
            rownms = getproperty(fcnames, grp)
            grpstr = String(grp)
            empty!(nrmdr)
            for (j, rnm, row) in zip(eachindex(rownms), rownms, eachrow(ll))
                push!.(cols, (i, "σ", grpstr, rnm, σ * norm(row)))
                push!(nrmdr, normalize(row))
                for k in 1:(j - 1)
                    push!.(
                        cols,
                        (
                            i,
                            "ρ",
                            grpstr,
                            string(rownms[k], ", ", rnm),
                            dot(nrmdr[j], nrmdr[k]),
                        ),
                    )
                end
            end
        end
        r.σ === missing || push!.(cols, (i, "σ", "residual", missing, r.σ))
    end
    return (
        iter=cols[1],
        type=PooledArray(cols[2]),
        group=PooledArray(cols[3]),
        names=PooledArray(cols[4]),
        value=cols[5],
    )
end

function Base.getproperty(bsamp::MixedModelFitCollection, s::Symbol)
    if s ∈ [:objective, :σ, :θ, :se]
        getproperty.(getfield(bsamp, :fits), s)
    elseif s == :β
        tidyβ(bsamp)
    elseif s == :coefpvalues
        coefpvalues(bsamp)
    elseif s == :σs
        tidyσs(bsamp)
    elseif s == :allpars
        allpars(bsamp)
    else
        getfield(bsamp, s)
    end
end

"""
    issingular(bsamp::MixedModelFitCollection)

Test each bootstrap sample for singularity of the corresponding fit.

Equality comparisons are used b/c small non-negative θ values are replaced by 0 in `fit!`.

See also [`issingular(::MixedModel)`](@ref).
"""
issingular(bsamp::MixedModelFitCollection) = map(θ -> any(θ .== bsamp.lowerbd), bsamp.θ)

Base.length(x::MixedModelFitCollection) = length(x.fits)

function Base.propertynames(bsamp::MixedModelFitCollection)
    return [
        :allpars,
        :objective,
        :σ,
        :β,
        :se,
        :coefpvalues,
        :θ,
        :σs,
        :λ,
        :inds,
        :lowerbd,
        :fits,
        :fcnames,
    ]
end

"""
    setθ!(bsamp::MixedModelFitCollection, i::Integer)

Install the values of the i'th θ value of `bsamp.fits` in `bsamp.λ`
"""
function setθ!(bsamp::MixedModelFitCollection, i::Integer)
    θ = bsamp.fits[i].θ
    offset = 0
    for (λ, inds) in zip(bsamp.λ, bsamp.inds)
        λdat = _getdata(λ)
        fill!(λdat, false)
        for j in eachindex(inds)
            λdat[inds[j]] = θ[j + offset]
        end
        offset += length(inds)
    end
    return bsamp
end

_getdata(x::Diagonal) = x
_getdata(x::LowerTriangular) = x.data

"""
    shortestcovint(v, level = 0.95)

Return the shortest interval containing `level` proportion of the values of `v`
"""
function shortestcovint(v, level=0.95)
    n = length(v)
    0 < level < 1 || throw(ArgumentError("level = $level should be in (0,1)"))
    vv = issorted(v) ? v : sort(v)
    ilen = Int(ceil(n * level)) # number of elements (counting endpoints) in interval
    # skip non-finite elements at the ends of sorted vv
    start = findfirst(isfinite, vv)
    stop = findlast(isfinite, vv)
    if stop < (start + ilen - 1)
        return (vv[1], vv[end])
    end
    len, i = findmin([vv[i + ilen - 1] - vv[i] for i in start:(stop + 1 - ilen)])
    return (vv[i], vv[i + ilen - 1])
end

"""
    shortestcovint(bsamp::MixedModelFitCollection, level = 0.95)

Return the shortest interval containing `level` proportion for each parameter from `bsamp.allpars`.

!!! warning
    Currently, correlations that are systematically zero are included in the
    the result. This may change in a future release without being considered
    a breaking change.
"""
function shortestcovint(bsamp::MixedModelFitCollection{T}, level=0.95) where {T}
    allpars = bsamp.allpars
    pars = unique(zip(allpars.type, allpars.group, allpars.names))

    colnms = (:type, :group, :names, :lower, :upper)
    coltypes = Tuple{String,Union{Missing,String},Union{Missing,String},T,T}
    # not specifying the full eltype (NamedTuple{colnms,coltypes}) leads to prettier printing
    result = NamedTuple{colnms}[]
    sizehint!(result, length(pars))

    for (t, g, n) in pars
        gidx = if ismissing(g)
            ismissing.(allpars.group)
        else
            .!ismissing.(allpars.group) .& (allpars.group .== g)
        end

        nidx = if ismissing(n)
            ismissing.(allpars.names)
        else
            .!ismissing.(allpars.names) .& (allpars.names .== n)
        end

        tidx = allpars.type .== t # no missings allowed here

        idx = tidx .& gidx .& nidx

        vv = view(allpars.value, idx)

        lower, upper = shortestcovint(vv, level)
        push!(result, (; type=t, group=g, names=n, lower=lower, upper=upper))
    end

    return result
end

"""
    tidyβ(bsamp::MixedModelFitCollection)
Return a tidy (row)table with the parameter estimates spread into columns
of `iter`, `coefname` and `β`
"""
function tidyβ(bsamp::MixedModelFitCollection{T}) where {T}
    fits = bsamp.fits
    colnms = (:iter, :coefname, :β)
    result = sizehint!(
        NamedTuple{colnms,Tuple{Int,Symbol,T}}[], length(fits) * length(first(fits).β)
    )
    for (i, r) in enumerate(fits)
        for (k, v) in pairs(r.β)
            push!(result, NamedTuple{colnms}((i, k, v)))
        end
    end
    return result
end

"""
    coefpvalues(bsamp::MixedModelFitCollection)

Return a rowtable with columns `(:iter, :coefname, :β, :se, :z, :p)`
"""
function coefpvalues(bsamp::MixedModelFitCollection{T}) where {T}
    fits = bsamp.fits
    colnms = (:iter, :coefname, :β, :se, :z, :p)
    result = sizehint!(
        NamedTuple{colnms,Tuple{Int,Symbol,T,T,T,T}}[], length(fits) * length(first(fits).β)
    )
    for (i, r) in enumerate(fits)
        for (p, s) in zip(pairs(r.β), r.se)
            β = last(p)
            z = β / s
            push!(result, NamedTuple{colnms}((i, first(p), β, s, z, 2normccdf(abs(z)))))
        end
    end
    return result
end

"""
    tidyσs(bsamp::MixedModelFitCollection)
Return a tidy (row)table with the estimates of the variance components (on the standard deviation scale) spread into columns
of `iter`, `group`, `column` and `σ`.
"""
function tidyσs(bsamp::MixedModelFitCollection{T}) where {T}
    fits = bsamp.fits
    fcnames = bsamp.fcnames
    λ = bsamp.λ
    colnms = (:iter, :group, :column, :σ)
    result = sizehint!(
        NamedTuple{colnms,Tuple{Int,Symbol,Symbol,T}}[], length(fits) * sum(length, fcnames)
    )
    for (iter, r) in enumerate(fits)
        setθ!(bsamp, iter)    # install r.θ in λ
        σ = coalesce(r.σ, one(T))
        for (grp, ll) in zip(keys(fcnames), λ)
            for (cn, col) in zip(getproperty(fcnames, grp), eachrow(ll))
                push!(result, NamedTuple{colnms}((iter, grp, Symbol(cn), σ * norm(col))))
            end
        end
    end
    return result
end


text:
"""
# Description

Given an expression, if the code is a function call expression, rewrite the
call to perform automatic lifting. See docs/lifting.md for details.

Any input that is not a function call is returned as is.

# Arguments

1. `e::Any`: An expression.

# Return Values

1. `_::Any`: A new expression in which lifting has been performed.

# Examples

```
julia> ...
```
"""
function lift_function_call(@nospecialize(e::Any))
    if isa(e, Expr) && e.head == :call
        e
        # TODO: Generate something like the following
        # if uses_default_lifting(foo)
        #     tmp1 = x
        #     if ismissing(tmp1)
        #         missing
        #     else
        #         f(tmp1)
        #     end
        # else
        #     f′ = lift(f)
        #     f′(args...)
        # end
    else
        e
    end
end

"""
# Description

Recursively descend an expression lifting all function calls.

# Arguments

1. `e::Any`: An expression.

# Return Values

1. `_::Any`: A new expression in which lifted has been performed.

# Examples

```
julia> ...
```

"""
function lift_function_calls(@nospecialize(e::Any))
    postwalk(lift_function_call, e)
end

"""
# Description

This is a generic function that specific functions can override to indicate
that they handle `missing` in a special way.

# Arguments

1. `f::Any`: A function-like object.

# Return Values

1. `_::Bool`: Does that function use the default lifting strategy outlined in
docs/lifting.md? If so, return `true`; else, return `false`.

# Examples

```
julia> uses_default_lifting(sin)
true
```
"""
uses_default_lifting(f::Any) = true

# TODO: Define lift(f:Any) = f
# TODO: Add all Base functions with non-standard lifting
# TODO: Reflect over methodswith(typeof(missing))
# Add all of these methods to the non-standard lifting list.
# for m in methodswith(typeof(missing))
#     uses_default_lifting(::typeof(m)) = false
#     lift(::typeof(m)) = m
# end


text:
#
# Tests for Jacobi sub-module
#

@testset "Jacobi" begin
    @testset "Abramowitz & Stegun Table 16.1" begin
        dataloc = "data/"
        # table 16.1
        t161, _ = readdlm(joinpath(dataloc, "table_16_1.csv"), ',', header=true)
        # table 17.2
        t172, _ = readdlm(joinpath(dataloc, "table_17_2.csv"), ',', header=true)

        K_lut = Dict(zip(t172[:, 1], t172[:, 2]))

        # data vary first by ϵ ∈ 0:5:90 then α ∈ 0:5:85
        αs = 0:5:85
        ϵs = 0:5:90
        θss = reshape(t161[:, 3], length(ϵs), length(αs))
        θns = reshape(t161[:, 4], length(ϵs), length(αs))

        @testset "α = $α" for (i, α) in enumerate(αs)
            K = K_lut[α]
            m = sind(α)^2
            denom = sqrt(secd(α))

            @testset "ϵ = $ϵ" for (j, ϵ) in enumerate(ϵs)
                j₁ = length(ϵs) - j + 1
                ϵ₁ = ϵs[j₁]
                u = ϵ * K / 90

                θs = θss[j, i]
                θn = θns[j, i]
                θc = θss[j₁, i]/denom
                θd = θns[j₁, i]/denom

                @test Jacobi.sn(u, m) ≈ θs / θn atol=2.5e-9
                @test Jacobi.cn(u, m) ≈ θc / θn atol=2.5e-9
                @test Jacobi.dn(u, m) ≈ θd / θn atol=2.5e-9
                @test Jacobi.nn(u, m) == 1.0

                @test Jacobi.sd(u, m) ≈ θs / θd atol=2.5e-9
                @test Jacobi.cd(u, m) ≈ θc / θd atol=2.5e-9
                @test Jacobi.dd(u, m) == 1.0
                @test Jacobi.nd(u, m) ≈ θn / θd atol=2.5e-9

                @test Jacobi.cc(u, m) == 1.0
                if ϵ != 90
                    # very sensitive around u = K,
                    # estimate of K(0) = pi/2 + 4e-9, so cosine causes errors
                    # also, errors build up in ϵ ≥75°, so lower tolerences for that
                    @test Jacobi.sc(u, m) ≈ θs / θc atol=1e-7
                    @test Jacobi.dc(u, m) ≈ θd / θc atol=1e-7
                    @test Jacobi.nc(u, m) ≈ θn / θc atol=1e-7
                end

                @test Jacobi.ss(u, m) == 1.0
                @test Jacobi.cs(u, m) ≈ θc / θs atol=5.5e-8
                @test Jacobi.ds(u, m) ≈ θd / θs atol=5.5e-8
                @test Jacobi.ns(u, m) ≈ θn / θs atol=5.5e-8

                # ellipj
                s, c, d = ellipj(u, m)
                @test s ≈ θs / θn atol=1e-9
                @test c ≈ θc / θn atol=1e-9
                @test d ≈ θd / θn atol=1e-9
            end
        end
    end

    @testset "u = $u" for u in -1.:0.21:1.0
        @test Jacobi.am(u,0) ≈ u
        @test Jacobi.sn(u,0) ≈ sin(u)
        @test Jacobi.cn(u,0) ≈ cos(u)
        @test Jacobi.dn(u,0) ≈ 1.
        @test Jacobi.nn(u,0) ≈ 1.
        @test Jacobi.cd(u,0) ≈ cos(u)
        @test Jacobi.sd(u,0) ≈ sin(u)
        @test Jacobi.nd(u,0) ≈ 1.
        @test Jacobi.dd(u,0) ≈ 1.
        @test Jacobi.dc(u,0) ≈ sec(u)
        @test Jacobi.nc(u,0) ≈ sec(u)
        @test Jacobi.sc(u,0) ≈ tan(u)
        @test Jacobi.cc(u,0) ≈ 1.
        @test Jacobi.ns(u,0) ≈ csc(u)
        @test Jacobi.ds(u,0) ≈ csc(u)
        @test Jacobi.cs(u,0) ≈ cot(u)
        @test Jacobi.ss(u,0) ≈ 1.

        @test Jacobi.am(u,1) ≈ atan(sinh(u))
        @test Jacobi.sn(u,1) ≈ tanh(u)
        @test Jacobi.cn(u,1) ≈ sech(u)
        @test Jacobi.dn(u,1) ≈ sech(u)
        @test Jacobi.nn(u,1) ≈ 1.
        @test Jacobi.cd(u,1) ≈ 1.
        @test Jacobi.sd(u,1) ≈ sinh(u)
        @test Jacobi.nd(u,1) ≈ cosh(u)
        @test Jacobi.dd(u,1) ≈ 1.
        @test Jacobi.dc(u,1) ≈ 1.
        @test Jacobi.nc(u,1) ≈ cosh(u)
        @test Jacobi.sc(u,1) ≈ sinh(u)
        @test Jacobi.cc(u,1) ≈ 1.
        @test Jacobi.ns(u,1) ≈ coth(u)
        @test Jacobi.ds(u,1) ≈ csch(u)
        @test Jacobi.cs(u,1) ≈ csch(u)
        @test Jacobi.ss(u,1) ≈ 1.
    end

    @testset "errors" begin
        u = 0.5 # random value for testing
        @test_throws DomainError Jacobi.am(u, -0.1)
        @test_throws DomainError Jacobi.am(u, -eps(0.0))

        @test_throws DomainError Jacobi.am(u, 1 + eps(1.0))
        @test_throws DomainError Jacobi.am(u, 1.1)
    end
end


text:
struct InputSignal{T<:Number}
    M::Matrix{T}
    ti::Float64
    tf::Float64
    Δt::Float64
end

function InputSignal(M::AbstractMatrix{T}, ti::Number=0.0,
                     tf::Number=ti+one(typeof(ti))) where {T<:Number}
    InputSignal{T}(Matrix(M), Float64(ti), Float64(tf), Float64(tf-ti)/size(M,2))
end

function (u::InputSignal)(t::Number)
    if u.ti <= t < u.tf
        j = Int(fld(t-u.ti, u.Δt)) + 1
        [u.M[i,j] for i in 1:size(u.M,1)]
    else
        return zeros(eltype(u.M), size(u.M,2))
    end
end