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

"""
    accept_invitation(detector_id, invitation_id, master_id)
    accept_invitation(detector_id, invitation_id, master_id, params::Dict{String,<:Any})

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

# Arguments
- `detector_id`: The unique ID of the detector of the GuardDuty member account.
- `invitation_id`: The value that is used to validate the administrator account to the
  member account.
- `master_id`: The account ID of the GuardDuty administrator account whose invitation
  you're accepting.

"""
accept_invitation(detectorId, invitationId, masterId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/master", Dict{String, Any}("invitationId"=>invitationId, "masterId"=>masterId); aws_config=aws_config)
accept_invitation(detectorId, invitationId, masterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/master", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("invitationId"=>invitationId, "masterId"=>masterId), params)); aws_config=aws_config)

"""
    archive_findings(detector_id, finding_ids)
    archive_findings(detector_id, finding_ids, params::Dict{String,<:Any})

Archives GuardDuty findings that are specified by the list of finding IDs.  Only the
administrator account can archive findings. Member accounts don't have permission to
archive findings from their accounts.

# Arguments
- `detector_id`: The ID of the detector that specifies the GuardDuty service whose findings
  you want to archive.
- `finding_ids`: The IDs of the findings that you want to archive.

"""
archive_findings(detectorId, findingIds; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/archive", Dict{String, Any}("findingIds"=>findingIds); aws_config=aws_config)
archive_findings(detectorId, findingIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/archive", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("findingIds"=>findingIds), params)); aws_config=aws_config)

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

Creates a single Amazon GuardDuty detector. A detector is a resource that represents the
GuardDuty service. To start using GuardDuty, you must create a detector in each Region
where you enable the service. You can have only one detector per account per Region. All
data sources are enabled in a new detector by default.

# Arguments
- `enable`: A Boolean value that specifies whether the detector is to be enabled.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: The idempotency token for the create request.
- `"dataSources"`: Describes which data sources will be enabled for the detector.
- `"findingPublishingFrequency"`: A value that specifies how frequently updated findings
  are exported.
- `"tags"`: The tags to be added to a new detector resource.
"""
create_detector(enable; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector", Dict{String, Any}("enable"=>enable, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_detector(enable, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("enable"=>enable, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    create_filter(detector_id, finding_criteria, name)
    create_filter(detector_id, finding_criteria, name, params::Dict{String,<:Any})

Creates a filter using the specified finding criteria.

# Arguments
- `detector_id`: The ID of the detector belonging to the GuardDuty account that you want to
  create a filter for.
- `finding_criteria`: Represents the criteria to be used in the filter for querying
  findings. You can only use the following attributes to query findings:   accountId   region
    confidence   id   resource.accessKeyDetails.accessKeyId
  resource.accessKeyDetails.principalId   resource.accessKeyDetails.userName
  resource.accessKeyDetails.userType   resource.instanceDetails.iamInstanceProfile.id
  resource.instanceDetails.imageId   resource.instanceDetails.instanceId
  resource.instanceDetails.outpostArn
  resource.instanceDetails.networkInterfaces.ipv6Addresses
  resource.instanceDetails.networkInterfaces.privateIpAddresses.privateIpAddress
  resource.instanceDetails.networkInterfaces.publicDnsName
  resource.instanceDetails.networkInterfaces.publicIp
  resource.instanceDetails.networkInterfaces.securityGroups.groupId
  resource.instanceDetails.networkInterfaces.securityGroups.groupName
  resource.instanceDetails.networkInterfaces.subnetId
  resource.instanceDetails.networkInterfaces.vpcId   resource.instanceDetails.tags.key
  resource.instanceDetails.tags.value   resource.resourceType   service.action.actionType
  service.action.awsApiCallAction.api   service.action.awsApiCallAction.callerType
  service.action.awsApiCallAction.errorCode
  service.action.awsApiCallAction.remoteIpDetails.city.cityName
  service.action.awsApiCallAction.remoteIpDetails.country.countryName
  service.action.awsApiCallAction.remoteIpDetails.ipAddressV4
  service.action.awsApiCallAction.remoteIpDetails.organization.asn
  service.action.awsApiCallAction.remoteIpDetails.organization.asnOrg
  service.action.awsApiCallAction.serviceName   service.action.dnsRequestAction.domain
  service.action.networkConnectionAction.blocked
  service.action.networkConnectionAction.connectionDirection
  service.action.networkConnectionAction.localPortDetails.port
  service.action.networkConnectionAction.protocol
  service.action.networkConnectionAction.localIpDetails.ipAddressV4
  service.action.networkConnectionAction.remoteIpDetails.city.cityName
  service.action.networkConnectionAction.remoteIpDetails.country.countryName
  service.action.networkConnectionAction.remoteIpDetails.ipAddressV4
  service.action.networkConnectionAction.remoteIpDetails.organization.asn
  service.action.networkConnectionAction.remoteIpDetails.organization.asnOrg
  service.action.networkConnectionAction.remotePortDetails.port
  service.additionalInfo.threatListName   service.archived When this attribute is set to
  TRUE, only archived findings are listed. When it's set to FALSE, only unarchived findings
  are listed. When this attribute is not set, all existing findings are listed.
  service.resourceRole   severity   type   updatedAt Type: ISO 8601 string format:
  YYYY-MM-DDTHH:MM:SS.SSSZ or YYYY-MM-DDTHH:MM:SSZ depending on whether the value contains
  milliseconds.
- `name`: The name of the filter. Minimum length of 3. Maximum length of 64. Valid
  characters include alphanumeric characters, dot (.), underscore (_), and dash (-). Spaces
  are not allowed.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"action"`: Specifies the action that is to be applied to the findings that match the
  filter.
- `"clientToken"`: The idempotency token for the create request.
- `"description"`: The description of the filter.
- `"rank"`: 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.
- `"tags"`: The tags to be added to a new filter resource.
"""
create_filter(detectorId, findingCriteria, name; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/filter", Dict{String, Any}("findingCriteria"=>findingCriteria, "name"=>name, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_filter(detectorId, findingCriteria, name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/filter", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("findingCriteria"=>findingCriteria, "name"=>name, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    create_ipset(activate, detector_id, format, location, name)
    create_ipset(activate, detector_id, format, location, name, params::Dict{String,<:Any})

Creates a new IPSet, which is called a trusted IP list in the console user interface. An
IPSet is a list of IP addresses that are trusted for secure communication with AWS
infrastructure and applications. GuardDuty doesn't generate findings for IP addresses that
are included in IPSets. Only users from the administrator account can use this operation.

# Arguments
- `activate`: A Boolean value that indicates whether GuardDuty is to start using the
  uploaded IPSet.
- `detector_id`: The unique ID of the detector of the GuardDuty account that you want to
  create an IPSet for.
- `format`: The format of the file that contains the IPSet.
- `location`: The URI of the file that contains the IPSet. For example:
  https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key.
- `name`: The user-friendly name to identify the IPSet.  Allowed characters are
  alphanumerics, spaces, hyphens (-), and underscores (_).

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: The idempotency token for the create request.
- `"tags"`: The tags to be added to a new IP set resource.
"""
create_ipset(activate, detectorId, format, location, name; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/ipset", Dict{String, Any}("activate"=>activate, "format"=>format, "location"=>location, "name"=>name, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_ipset(activate, detectorId, format, location, name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/ipset", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("activate"=>activate, "format"=>format, "location"=>location, "name"=>name, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    create_members(account_details, detector_id)
    create_members(account_details, detector_id, params::Dict{String,<:Any})

Creates member accounts of the current AWS account by specifying a list of AWS account IDs.
This step is a prerequisite for managing the associated member accounts either by
invitation or through an organization. When using Create Members as an organizations
delegated administrator this action will enable GuardDuty in the added member accounts,
with the exception of the organization delegated administrator account, which must enable
GuardDuty prior to being added as a member. If you are adding accounts by invitation use
this action after GuardDuty has been enabled in potential member accounts and before using
Invite Members .

# Arguments
- `account_details`: A list of account ID and email address pairs of the accounts that you
  want to associate with the GuardDuty administrator account.
- `detector_id`: The unique ID of the detector of the GuardDuty account that you want to
  associate member accounts with.

"""
create_members(accountDetails, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member", Dict{String, Any}("accountDetails"=>accountDetails); aws_config=aws_config)
create_members(accountDetails, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountDetails"=>accountDetails), params)); aws_config=aws_config)

"""
    create_publishing_destination(destination_properties, destination_type, detector_id)
    create_publishing_destination(destination_properties, destination_type, detector_id, params::Dict{String,<:Any})

Creates a publishing destination to export findings to. The resource to export findings to
must exist before you use this operation.

# Arguments
- `destination_properties`: The properties of the publishing destination, including the
  ARNs for the destination and the KMS key used for encryption.
- `destination_type`: The type of resource for the publishing destination. Currently only
  Amazon S3 buckets are supported.
- `detector_id`: The ID of the GuardDuty detector associated with the publishing
  destination.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: The idempotency token for the request.
"""
create_publishing_destination(destinationProperties, destinationType, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/publishingDestination", Dict{String, Any}("destinationProperties"=>destinationProperties, "destinationType"=>destinationType, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_publishing_destination(destinationProperties, destinationType, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/publishingDestination", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("destinationProperties"=>destinationProperties, "destinationType"=>destinationType, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

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
- `detector_id`: The ID of the detector to create sample findings for.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingTypes"`: The types of sample findings to generate.
"""
create_sample_findings(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/create"; aws_config=aws_config)
create_sample_findings(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/create", params; aws_config=aws_config)

"""
    create_threat_intel_set(activate, detector_id, format, location, name)
    create_threat_intel_set(activate, detector_id, format, location, name, params::Dict{String,<:Any})

Creates a new ThreatIntelSet. ThreatIntelSets consist of known malicious IP addresses.
GuardDuty generates findings based on ThreatIntelSets. Only users of the administrator
account can use this operation.

# Arguments
- `activate`: A Boolean value that indicates whether GuardDuty is to start using the
  uploaded ThreatIntelSet.
- `detector_id`: The unique ID of the detector of the GuardDuty account that you want to
  create a threatIntelSet for.
- `format`: The format of the file that contains the ThreatIntelSet.
- `location`: The URI of the file that contains the ThreatIntelSet. For example:
  https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key.
- `name`: A user-friendly ThreatIntelSet name displayed in all findings that are generated
  by activity that involves IP addresses included in this ThreatIntelSet.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: The idempotency token for the create request.
- `"tags"`: The tags to be added to a new threat list resource.
"""
create_threat_intel_set(activate, detectorId, format, location, name; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/threatintelset", Dict{String, Any}("activate"=>activate, "format"=>format, "location"=>location, "name"=>name, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_threat_intel_set(activate, detectorId, format, location, name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/threatintelset", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("activate"=>activate, "format"=>format, "location"=>location, "name"=>name, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

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

# Arguments
- `account_ids`: A list of account IDs of the AWS accounts that sent invitations to the
  current member account that you want to decline invitations from.

"""
decline_invitations(accountIds; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/invitation/decline", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
decline_invitations(accountIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/invitation/decline", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

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

Deletes an Amazon GuardDuty detector that is specified by the detector ID.

# Arguments
- `detector_id`: The unique ID of the detector that you want to delete.

"""
delete_detector(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)"; aws_config=aws_config)
delete_detector(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)", params; aws_config=aws_config)

"""
    delete_filter(detector_id, filter_name)
    delete_filter(detector_id, filter_name, params::Dict{String,<:Any})

Deletes the filter specified by the filter name.

# Arguments
- `detector_id`: The unique ID of the detector that the filter is associated with.
- `filter_name`: The name of the filter that you want to delete.

"""
delete_filter(detectorId, filterName; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/filter/$(filterName)"; aws_config=aws_config)
delete_filter(detectorId, filterName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/filter/$(filterName)", params; aws_config=aws_config)

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

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

# Arguments
- `account_ids`: A list of account IDs of the AWS accounts that sent invitations to the
  current member account that you want to delete invitations from.

"""
delete_invitations(accountIds; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/invitation/delete", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
delete_invitations(accountIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/invitation/delete", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

"""
    delete_ipset(detector_id, ip_set_id)
    delete_ipset(detector_id, ip_set_id, params::Dict{String,<:Any})

Deletes the IPSet specified by the ipSetId. IPSets are called trusted IP lists in the
console user interface.

# Arguments
- `detector_id`: The unique ID of the detector associated with the IPSet.
- `ip_set_id`: The unique ID of the IPSet to delete.

"""
delete_ipset(detectorId, ipSetId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/ipset/$(ipSetId)"; aws_config=aws_config)
delete_ipset(detectorId, ipSetId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/ipset/$(ipSetId)", params; aws_config=aws_config)

"""
    delete_members(account_ids, detector_id)
    delete_members(account_ids, detector_id, params::Dict{String,<:Any})

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

# Arguments
- `account_ids`: A list of account IDs of the GuardDuty member accounts that you want to
  delete.
- `detector_id`: The unique ID of the detector of the GuardDuty account whose members you
  want to delete.

"""
delete_members(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/delete", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
delete_members(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/delete", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

"""
    delete_publishing_destination(destination_id, detector_id)
    delete_publishing_destination(destination_id, detector_id, params::Dict{String,<:Any})

Deletes the publishing definition with the specified destinationId.

# Arguments
- `destination_id`: The ID of the publishing destination to delete.
- `detector_id`: The unique ID of the detector associated with the publishing destination
  to delete.

"""
delete_publishing_destination(destinationId, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/publishingDestination/$(destinationId)"; aws_config=aws_config)
delete_publishing_destination(destinationId, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/publishingDestination/$(destinationId)", params; aws_config=aws_config)

"""
    delete_threat_intel_set(detector_id, threat_intel_set_id)
    delete_threat_intel_set(detector_id, threat_intel_set_id, params::Dict{String,<:Any})

Deletes the ThreatIntelSet specified by the ThreatIntelSet ID.

# Arguments
- `detector_id`: The unique ID of the detector that the threatIntelSet is associated with.
- `threat_intel_set_id`: The unique ID of the threatIntelSet that you want to delete.

"""
delete_threat_intel_set(detectorId, threatIntelSetId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/threatintelset/$(threatIntelSetId)"; aws_config=aws_config)
delete_threat_intel_set(detectorId, threatIntelSetId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/detector/$(detectorId)/threatintelset/$(threatIntelSetId)", params; aws_config=aws_config)

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

Returns information about the account selected as the delegated administrator for GuardDuty.

# Arguments
- `detector_id`: The ID of the detector to retrieve information about the delegated
  administrator from.

"""
describe_organization_configuration(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/admin"; aws_config=aws_config)
describe_organization_configuration(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/admin", params; aws_config=aws_config)

"""
    describe_publishing_destination(destination_id, detector_id)
    describe_publishing_destination(destination_id, detector_id, params::Dict{String,<:Any})

Returns information about the publishing destination specified by the provided
destinationId.

# Arguments
- `destination_id`: The ID of the publishing destination to retrieve.
- `detector_id`: The unique ID of the detector associated with the publishing destination
  to retrieve.

"""
describe_publishing_destination(destinationId, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/publishingDestination/$(destinationId)"; aws_config=aws_config)
describe_publishing_destination(destinationId, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/publishingDestination/$(destinationId)", params; aws_config=aws_config)

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

Disables an AWS account within the Organization as the GuardDuty delegated administrator.

# Arguments
- `admin_account_id`: The AWS Account ID for the organizations account to be disabled as a
  GuardDuty delegated administrator.

"""
disable_organization_admin_account(adminAccountId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/admin/disable", Dict{String, Any}("adminAccountId"=>adminAccountId); aws_config=aws_config)
disable_organization_admin_account(adminAccountId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/admin/disable", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("adminAccountId"=>adminAccountId), params)); aws_config=aws_config)

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

Disassociates the current GuardDuty member account from its administrator account.

# Arguments
- `detector_id`: The unique ID of the detector of the GuardDuty member account.

"""
disassociate_from_master_account(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/master/disassociate"; aws_config=aws_config)
disassociate_from_master_account(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/master/disassociate", params; aws_config=aws_config)

"""
    disassociate_members(account_ids, detector_id)
    disassociate_members(account_ids, detector_id, params::Dict{String,<:Any})

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

# Arguments
- `account_ids`: A list of account IDs of the GuardDuty member accounts that you want to
  disassociate from the administrator account.
- `detector_id`: The unique ID of the detector of the GuardDuty account whose members you
  want to disassociate from the administrator account.

"""
disassociate_members(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/disassociate", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
disassociate_members(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/disassociate", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

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

Enables an AWS account within the organization as the GuardDuty delegated administrator.

# Arguments
- `admin_account_id`: The AWS Account ID for the organization account to be enabled as a
  GuardDuty delegated administrator.

"""
enable_organization_admin_account(adminAccountId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/admin/enable", Dict{String, Any}("adminAccountId"=>adminAccountId); aws_config=aws_config)
enable_organization_admin_account(adminAccountId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/admin/enable", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("adminAccountId"=>adminAccountId), params)); aws_config=aws_config)

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

Retrieves an Amazon GuardDuty detector specified by the detectorId.

# Arguments
- `detector_id`: The unique ID of the detector that you want to get.

"""
get_detector(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)"; aws_config=aws_config)
get_detector(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)", params; aws_config=aws_config)

"""
    get_filter(detector_id, filter_name)
    get_filter(detector_id, filter_name, params::Dict{String,<:Any})

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

# Arguments
- `detector_id`: The unique ID of the detector that the filter is associated with.
- `filter_name`: The name of the filter you want to get.

"""
get_filter(detectorId, filterName; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/filter/$(filterName)"; aws_config=aws_config)
get_filter(detectorId, filterName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/filter/$(filterName)", params; aws_config=aws_config)

"""
    get_findings(detector_id, finding_ids)
    get_findings(detector_id, finding_ids, params::Dict{String,<:Any})

Describes Amazon GuardDuty findings specified by finding IDs.

# Arguments
- `detector_id`: The ID of the detector that specifies the GuardDuty service whose findings
  you want to retrieve.
- `finding_ids`: The IDs of the findings that you want to retrieve.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"sortCriteria"`: Represents the criteria used for sorting findings.
"""
get_findings(detectorId, findingIds; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/get", Dict{String, Any}("findingIds"=>findingIds); aws_config=aws_config)
get_findings(detectorId, findingIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/get", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("findingIds"=>findingIds), params)); aws_config=aws_config)

"""
    get_findings_statistics(detector_id, finding_statistic_types)
    get_findings_statistics(detector_id, finding_statistic_types, params::Dict{String,<:Any})

Lists Amazon GuardDuty findings statistics for the specified detector ID.

# Arguments
- `detector_id`: The ID of the detector that specifies the GuardDuty service whose
  findings' statistics you want to retrieve.
- `finding_statistic_types`: The types of finding statistics to retrieve.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingCriteria"`: Represents the criteria that is used for querying findings.
"""
get_findings_statistics(detectorId, findingStatisticTypes; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/statistics", Dict{String, Any}("findingStatisticTypes"=>findingStatisticTypes); aws_config=aws_config)
get_findings_statistics(detectorId, findingStatisticTypes, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/statistics", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("findingStatisticTypes"=>findingStatisticTypes), params)); aws_config=aws_config)

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

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

"""
get_invitations_count(; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/invitation/count"; aws_config=aws_config)
get_invitations_count(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/invitation/count", params; aws_config=aws_config)

"""
    get_ipset(detector_id, ip_set_id)
    get_ipset(detector_id, ip_set_id, params::Dict{String,<:Any})

Retrieves the IPSet specified by the ipSetId.

# Arguments
- `detector_id`: The unique ID of the detector that the IPSet is associated with.
- `ip_set_id`: The unique ID of the IPSet to retrieve.

"""
get_ipset(detectorId, ipSetId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/ipset/$(ipSetId)"; aws_config=aws_config)
get_ipset(detectorId, ipSetId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/ipset/$(ipSetId)", params; aws_config=aws_config)

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

Provides the details for the GuardDuty administrator account associated with the current
GuardDuty member account.

# Arguments
- `detector_id`: The unique ID of the detector of the GuardDuty member account.

"""
get_master_account(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/master"; aws_config=aws_config)
get_master_account(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/master", params; aws_config=aws_config)

"""
    get_member_detectors(account_ids, detector_id)
    get_member_detectors(account_ids, detector_id, params::Dict{String,<:Any})

Describes which data sources are enabled for the member account's detector.

# Arguments
- `account_ids`: The account ID of the member account.
- `detector_id`: The detector ID for the administrator account.

"""
get_member_detectors(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/detector/get", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
get_member_detectors(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/detector/get", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

"""
    get_members(account_ids, detector_id)
    get_members(account_ids, detector_id, params::Dict{String,<:Any})

Retrieves GuardDuty member accounts (of the current GuardDuty administrator account)
specified by the account IDs.

# Arguments
- `account_ids`: A list of account IDs of the GuardDuty member accounts that you want to
  describe.
- `detector_id`: The unique ID of the detector of the GuardDuty account whose members you
  want to retrieve.

"""
get_members(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/get", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
get_members(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/get", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

"""
    get_threat_intel_set(detector_id, threat_intel_set_id)
    get_threat_intel_set(detector_id, threat_intel_set_id, params::Dict{String,<:Any})

Retrieves the ThreatIntelSet that is specified by the ThreatIntelSet ID.

# Arguments
- `detector_id`: The unique ID of the detector that the threatIntelSet is associated with.
- `threat_intel_set_id`: The unique ID of the threatIntelSet that you want to get.

"""
get_threat_intel_set(detectorId, threatIntelSetId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/threatintelset/$(threatIntelSetId)"; aws_config=aws_config)
get_threat_intel_set(detectorId, threatIntelSetId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/threatintelset/$(threatIntelSetId)", params; aws_config=aws_config)

"""
    get_usage_statistics(detector_id, usage_criteria, usage_statistics_type)
    get_usage_statistics(detector_id, usage_criteria, usage_statistics_type, params::Dict{String,<:Any})

Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector
ID. For newly enabled detectors or data sources the cost returned will include only the
usage so far under 30 days, this may differ from the cost metrics in the console, which
projects usage over 30 days to provide a monthly cost estimate. For more information see
Understanding How Usage Costs are Calculated.

# Arguments
- `detector_id`: The ID of the detector that specifies the GuardDuty service whose usage
  statistics you want to retrieve.
- `usage_criteria`: Represents the criteria used for querying usage.
- `usage_statistics_type`: The type of usage statistics to retrieve.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to return in the response.
- `"nextToken"`: A token to use for paginating results that are returned in the response.
  Set the value of this parameter to null for the first request to a list action. For
  subsequent calls, use the NextToken value returned from the previous request to continue
  listing results after the first page.
- `"unit"`: The currency unit you would like to view your usage statistics in. Current
  valid values are USD.
"""
get_usage_statistics(detectorId, usageCriteria, usageStatisticsType; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/usage/statistics", Dict{String, Any}("usageCriteria"=>usageCriteria, "usageStatisticsType"=>usageStatisticsType); aws_config=aws_config)
get_usage_statistics(detectorId, usageCriteria, usageStatisticsType, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/usage/statistics", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("usageCriteria"=>usageCriteria, "usageStatisticsType"=>usageStatisticsType), params)); aws_config=aws_config)

"""
    invite_members(account_ids, detector_id)
    invite_members(account_ids, detector_id, params::Dict{String,<:Any})

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'
findings on their behalf as the GuardDuty administrator account.

# Arguments
- `account_ids`: A list of account IDs of the accounts that you want to invite to GuardDuty
  as members.
- `detector_id`: The unique ID of the detector of the GuardDuty account that you want to
  invite members with.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"disableEmailNotification"`: A Boolean value that specifies whether you want to disable
  email notification to the accounts that you are inviting to GuardDuty as members.
- `"message"`: The invitation message that you want to send to the accounts that you're
  inviting to GuardDuty as members.
"""
invite_members(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/invite", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
invite_members(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/invite", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

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

Lists detectorIds of all the existing Amazon GuardDuty detector resources.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: You can use this parameter to indicate the maximum number of items that
  you want in the response. The default value is 50. The maximum value is 50.
- `"nextToken"`: You can use this parameter when paginating results. Set the value of this
  parameter to null on your first call to the list 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.
"""
list_detectors(; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector"; aws_config=aws_config)
list_detectors(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector", params; aws_config=aws_config)

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

Returns a paginated list of the current filters.

# Arguments
- `detector_id`: The unique ID of the detector that the filter is associated with.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: You can use this parameter to indicate the maximum number of items that
  you want in the response. The default value is 50. The maximum value is 50.
- `"nextToken"`: You can use this parameter when paginating results. Set the value of this
  parameter to null on your first call to the list 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.
"""
list_filters(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/filter"; aws_config=aws_config)
list_filters(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/filter", params; aws_config=aws_config)

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

Lists Amazon GuardDuty findings for the specified detector ID.

# Arguments
- `detector_id`: The ID of the detector that specifies the GuardDuty service whose findings
  you want to list.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingCriteria"`: Represents the criteria used for querying findings. Valid values
  include:   JSON field name   accountId   region   confidence   id
  resource.accessKeyDetails.accessKeyId   resource.accessKeyDetails.principalId
  resource.accessKeyDetails.userName   resource.accessKeyDetails.userType
  resource.instanceDetails.iamInstanceProfile.id   resource.instanceDetails.imageId
  resource.instanceDetails.instanceId
  resource.instanceDetails.networkInterfaces.ipv6Addresses
  resource.instanceDetails.networkInterfaces.privateIpAddresses.privateIpAddress
  resource.instanceDetails.networkInterfaces.publicDnsName
  resource.instanceDetails.networkInterfaces.publicIp
  resource.instanceDetails.networkInterfaces.securityGroups.groupId
  resource.instanceDetails.networkInterfaces.securityGroups.groupName
  resource.instanceDetails.networkInterfaces.subnetId
  resource.instanceDetails.networkInterfaces.vpcId   resource.instanceDetails.tags.key
  resource.instanceDetails.tags.value   resource.resourceType   service.action.actionType
  service.action.awsApiCallAction.api   service.action.awsApiCallAction.callerType
  service.action.awsApiCallAction.remoteIpDetails.city.cityName
  service.action.awsApiCallAction.remoteIpDetails.country.countryName
  service.action.awsApiCallAction.remoteIpDetails.ipAddressV4
  service.action.awsApiCallAction.remoteIpDetails.organization.asn
  service.action.awsApiCallAction.remoteIpDetails.organization.asnOrg
  service.action.awsApiCallAction.serviceName   service.action.dnsRequestAction.domain
  service.action.networkConnectionAction.blocked
  service.action.networkConnectionAction.connectionDirection
  service.action.networkConnectionAction.localPortDetails.port
  service.action.networkConnectionAction.protocol
  service.action.networkConnectionAction.remoteIpDetails.city.cityName
  service.action.networkConnectionAction.remoteIpDetails.country.countryName
  service.action.networkConnectionAction.remoteIpDetails.ipAddressV4
  service.action.networkConnectionAction.remoteIpDetails.organization.asn
  service.action.networkConnectionAction.remoteIpDetails.organization.asnOrg
  service.action.networkConnectionAction.remotePortDetails.port
  service.additionalInfo.threatListName   service.archived When this attribute is set to
  'true', only archived findings are listed. When it's set to 'false', only unarchived
  findings are listed. When this attribute is not set, all existing findings are listed.
  service.resourceRole   severity   type   updatedAt Type: Timestamp in Unix Epoch
  millisecond format: 1486685375000
- `"maxResults"`: 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"`: You can use this parameter when paginating results. Set the value of this
  parameter to null on your first call to the list 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.
"""
list_findings(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings"; aws_config=aws_config)
list_findings(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings", params; aws_config=aws_config)

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

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

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: You can use this parameter to indicate the maximum number of items that
  you want in the response. The default value is 50. The maximum value is 50.
- `"nextToken"`: You can use this parameter when paginating results. Set the value of this
  parameter to null on your first call to the list 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.
"""
list_invitations(; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/invitation"; aws_config=aws_config)
list_invitations(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/invitation", params; aws_config=aws_config)

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

Lists the IPSets of the GuardDuty service specified by the detector ID. If you use this
operation from a member account, the IPSets returned are the IPSets from the associated
administrator account.

# Arguments
- `detector_id`: The unique ID of the detector that the IPSet is associated with.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: 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"`: You can use this parameter when paginating results. Set the value of this
  parameter to null on your first call to the list 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.
"""
list_ipsets(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/ipset"; aws_config=aws_config)
list_ipsets(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/ipset", params; aws_config=aws_config)

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

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

# Arguments
- `detector_id`: The unique ID of the detector the member is associated with.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: 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"`: You can use this parameter when paginating results. Set the value of this
  parameter to null on your first call to the list 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.
- `"onlyAssociated"`: Specifies whether to only return associated members or to return all
  members (including members who haven't been invited yet or have been disassociated).
"""
list_members(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/member"; aws_config=aws_config)
list_members(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/member", params; aws_config=aws_config)

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

Lists the accounts configured as GuardDuty delegated administrators.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to return in the response.
- `"nextToken"`: A token to use for paginating results that are returned in the response.
  Set the value of this parameter to null for the first request to a list action. For
  subsequent calls, use the NextToken value returned from the previous request to continue
  listing results after the first page.
"""
list_organization_admin_accounts(; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/admin"; aws_config=aws_config)
list_organization_admin_accounts(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/admin", params; aws_config=aws_config)

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

Returns a list of publishing destinations associated with the specified dectectorId.

# Arguments
- `detector_id`: The ID of the detector to retrieve publishing destinations for.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to return in the response.
- `"nextToken"`: A token to use for paginating results that are returned in the response.
  Set the value of this parameter to null for the first request to a list action. For
  subsequent calls, use the NextToken value returned from the previous request to continue
  listing results after the first page.
"""
list_publishing_destinations(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/publishingDestination"; aws_config=aws_config)
list_publishing_destinations(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/publishingDestination", params; aws_config=aws_config)

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

Lists tags for a resource. Tagging is currently supported for detectors, finding filters,
IP sets, and threat intel sets, with a limit of 50 tags per resource. When invoked, this
operation returns all assigned tags for a given resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) for the given GuardDuty resource.

"""
list_tags_for_resource(resourceArn; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/tags/$(resourceArn)"; aws_config=aws_config)
list_tags_for_resource(resourceArn, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/tags/$(resourceArn)", params; aws_config=aws_config)

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

Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID. If you use
this operation from a member account, the ThreatIntelSets associated with the administrator
account are returned.

# Arguments
- `detector_id`: The unique ID of the detector that the threatIntelSet is associated with.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: You can use this parameter to indicate the maximum number of items that
  you want in the response. The default value is 50. The maximum value is 50.
- `"nextToken"`: You can use this parameter to paginate results in the response. Set the
  value of this parameter to null on your first call to the list 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.
"""
list_threat_intel_sets(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/threatintelset"; aws_config=aws_config)
list_threat_intel_sets(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("GET", "/detector/$(detectorId)/threatintelset", params; aws_config=aws_config)

"""
    start_monitoring_members(account_ids, detector_id)
    start_monitoring_members(account_ids, detector_id, params::Dict{String,<:Any})

Turns on GuardDuty monitoring of the specified member accounts. Use this operation to
restart monitoring of accounts that you stopped monitoring with the StopMonitoringMembers
operation.

# Arguments
- `account_ids`: A list of account IDs of the GuardDuty member accounts to start monitoring.
- `detector_id`: The unique ID of the detector of the GuardDuty administrator account
  associated with the member accounts to monitor.

"""
start_monitoring_members(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/start", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
start_monitoring_members(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/start", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

"""
    stop_monitoring_members(account_ids, detector_id)
    stop_monitoring_members(account_ids, detector_id, params::Dict{String,<:Any})

Stops GuardDuty monitoring for the specified member accounts. Use the
StartMonitoringMembers operation to restart monitoring for those accounts.

# Arguments
- `account_ids`: A list of account IDs for the member accounts to stop monitoring.
- `detector_id`: The unique ID of the detector associated with the GuardDuty administrator
  account that is monitoring member accounts.

"""
stop_monitoring_members(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/stop", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
stop_monitoring_members(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/stop", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

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

Adds tags to a resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) for the GuardDuty resource to apply a tag
  to.
- `tags`: The tags to be added to a resource.

"""
tag_resource(resourceArn, tags; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/tags/$(resourceArn)", Dict{String, Any}("tags"=>tags); aws_config=aws_config)
tag_resource(resourceArn, tags, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/tags/$(resourceArn)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("tags"=>tags), params)); aws_config=aws_config)

"""
    unarchive_findings(detector_id, finding_ids)
    unarchive_findings(detector_id, finding_ids, params::Dict{String,<:Any})

Unarchives GuardDuty findings specified by the findingIds.

# Arguments
- `detector_id`: The ID of the detector associated with the findings to unarchive.
- `finding_ids`: The IDs of the findings to unarchive.

"""
unarchive_findings(detectorId, findingIds; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/unarchive", Dict{String, Any}("findingIds"=>findingIds); aws_config=aws_config)
unarchive_findings(detectorId, findingIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/unarchive", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("findingIds"=>findingIds), params)); aws_config=aws_config)

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

Removes tags from a resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) for the resource to remove tags from.
- `tag_keys`: The tag keys to remove from the resource.

"""
untag_resource(resourceArn, tagKeys; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/tags/$(resourceArn)", Dict{String, Any}("tagKeys"=>tagKeys); aws_config=aws_config)
untag_resource(resourceArn, tagKeys, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("DELETE", "/tags/$(resourceArn)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("tagKeys"=>tagKeys), params)); aws_config=aws_config)

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

Updates the Amazon GuardDuty detector specified by the detectorId.

# Arguments
- `detector_id`: The unique ID of the detector to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"dataSources"`: Describes which data sources will be updated.
- `"enable"`: Specifies whether the detector is enabled or not enabled.
- `"findingPublishingFrequency"`: An enum value that specifies how frequently findings are
  exported, such as to CloudWatch Events.
"""
update_detector(detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)"; aws_config=aws_config)
update_detector(detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)", params; aws_config=aws_config)

"""
    update_filter(detector_id, filter_name)
    update_filter(detector_id, filter_name, params::Dict{String,<:Any})

Updates the filter specified by the filter name.

# Arguments
- `detector_id`: The unique ID of the detector that specifies the GuardDuty service where
  you want to update a filter.
- `filter_name`: The name of the filter.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"action"`: Specifies the action that is to be applied to the findings that match the
  filter.
- `"description"`: The description of the filter.
- `"findingCriteria"`: Represents the criteria to be used in the filter for querying
  findings.
- `"rank"`: 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.
"""
update_filter(detectorId, filterName; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/filter/$(filterName)"; aws_config=aws_config)
update_filter(detectorId, filterName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/filter/$(filterName)", params; aws_config=aws_config)

"""
    update_findings_feedback(detector_id, feedback, finding_ids)
    update_findings_feedback(detector_id, feedback, finding_ids, params::Dict{String,<:Any})

Marks the specified GuardDuty findings as useful or not useful.

# Arguments
- `detector_id`: The ID of the detector associated with the findings to update feedback for.
- `feedback`: The feedback for the finding.
- `finding_ids`: The IDs of the findings that you want to mark as useful or not useful.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"comments"`: Additional feedback about the GuardDuty findings.
"""
update_findings_feedback(detectorId, feedback, findingIds; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/feedback", Dict{String, Any}("feedback"=>feedback, "findingIds"=>findingIds); aws_config=aws_config)
update_findings_feedback(detectorId, feedback, findingIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/findings/feedback", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("feedback"=>feedback, "findingIds"=>findingIds), params)); aws_config=aws_config)

"""
    update_ipset(detector_id, ip_set_id)
    update_ipset(detector_id, ip_set_id, params::Dict{String,<:Any})

Updates the IPSet specified by the IPSet ID.

# Arguments
- `detector_id`: The detectorID that specifies the GuardDuty service whose IPSet you want
  to update.
- `ip_set_id`: The unique ID that specifies the IPSet that you want to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"activate"`: The updated Boolean value that specifies whether the IPSet is active or not.
- `"location"`: 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"`: The unique ID that specifies the IPSet that you want to update.
"""
update_ipset(detectorId, ipSetId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/ipset/$(ipSetId)"; aws_config=aws_config)
update_ipset(detectorId, ipSetId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/ipset/$(ipSetId)", params; aws_config=aws_config)

"""
    update_member_detectors(account_ids, detector_id)
    update_member_detectors(account_ids, detector_id, params::Dict{String,<:Any})

Contains information on member accounts to be updated.

# Arguments
- `account_ids`: A list of member account IDs to be updated.
- `detector_id`: The detector ID of the administrator account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"dataSources"`: Describes which data sources will be updated.
"""
update_member_detectors(accountIds, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/detector/update", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
update_member_detectors(accountIds, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/member/detector/update", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

"""
    update_organization_configuration(auto_enable, detector_id)
    update_organization_configuration(auto_enable, detector_id, params::Dict{String,<:Any})

Updates the delegated administrator account with the values provided.

# Arguments
- `auto_enable`: Indicates whether to automatically enable member accounts in the
  organization.
- `detector_id`: The ID of the detector to update the delegated administrator for.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"dataSources"`: Describes which data sources will be updated.
"""
update_organization_configuration(autoEnable, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/admin", Dict{String, Any}("autoEnable"=>autoEnable); aws_config=aws_config)
update_organization_configuration(autoEnable, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/admin", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("autoEnable"=>autoEnable), params)); aws_config=aws_config)

"""
    update_publishing_destination(destination_id, detector_id)
    update_publishing_destination(destination_id, detector_id, params::Dict{String,<:Any})

Updates information about the publishing destination specified by the destinationId.

# Arguments
- `destination_id`: The ID of the publishing destination to update.
- `detector_id`: The ID of the detector associated with the publishing destinations to
  update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"destinationProperties"`: A DestinationProperties object that includes the
  DestinationArn and KmsKeyArn of the publishing destination.
"""
update_publishing_destination(destinationId, detectorId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/publishingDestination/$(destinationId)"; aws_config=aws_config)
update_publishing_destination(destinationId, detectorId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/publishingDestination/$(destinationId)", params; aws_config=aws_config)

"""
    update_threat_intel_set(detector_id, threat_intel_set_id)
    update_threat_intel_set(detector_id, threat_intel_set_id, params::Dict{String,<:Any})

Updates the ThreatIntelSet specified by the ThreatIntelSet ID.

# Arguments
- `detector_id`: The detectorID that specifies the GuardDuty service whose ThreatIntelSet
  you want to update.
- `threat_intel_set_id`: The unique ID that specifies the ThreatIntelSet that you want to
  update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"activate"`: The updated Boolean value that specifies whether the ThreateIntelSet is
  active or not.
- `"location"`: The updated URI of the file that contains the ThreateIntelSet.
- `"name"`: The unique ID that specifies the ThreatIntelSet that you want to update.
"""
update_threat_intel_set(detectorId, threatIntelSetId; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/threatintelset/$(threatIntelSetId)"; aws_config=aws_config)
update_threat_intel_set(detectorId, threatIntelSetId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = guardduty("POST", "/detector/$(detectorId)/threatintelset/$(threatIntelSetId)", params; aws_config=aws_config)


text:
# This file is a part of Julia. License is MIT: https://julialang.org/license

# Eigensolvers for symmetric and Hermitian matrices
eigen!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}; sortby::Union{Function,Nothing}=nothing) =
    Eigen(sorteig!(LAPACK.syevr!('V', 'A', A.uplo, A.data, 0.0, 0.0, 0, 0, -1.0)..., sortby)...)

function eigen(A::RealHermSymComplexHerm; sortby::Union{Function,Nothing}=nothing)
    T = eltype(A)
    S = eigtype(T)
    eigen!(S != T ? convert(AbstractMatrix{S}, A) : copy(A), sortby=sortby)
end

eigen!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}, irange::UnitRange) =
    Eigen(LAPACK.syevr!('V', 'I', A.uplo, A.data, 0.0, 0.0, irange.start, irange.stop, -1.0)...)

"""
    eigen(A::Union{SymTridiagonal, Hermitian, Symmetric}, irange::UnitRange) -> Eigen

Computes the eigenvalue decomposition of `A`, returning an [`Eigen`](@ref) factorization object `F`
which contains the eigenvalues in `F.values` and the eigenvectors in the columns of the
matrix `F.vectors`. (The `k`th eigenvector can be obtained from the slice `F.vectors[:, k]`.)

Iterating the decomposition produces the components `F.values` and `F.vectors`.

The following functions are available for `Eigen` objects: [`inv`](@ref), [`det`](@ref), and [`isposdef`](@ref).

The [`UnitRange`](@ref) `irange` specifies indices of the sorted eigenvalues to search for.

!!! note
    If `irange` is not `1:n`, where `n` is the dimension of `A`, then the returned factorization
    will be a *truncated* factorization.
"""
function eigen(A::RealHermSymComplexHerm, irange::UnitRange)
    T = eltype(A)
    S = eigtype(T)
    eigen!(S != T ? convert(AbstractMatrix{S}, A) : copy(A), irange)
end

eigen!(A::RealHermSymComplexHerm{T,<:StridedMatrix}, vl::Real, vh::Real) where {T<:BlasReal} =
    Eigen(LAPACK.syevr!('V', 'V', A.uplo, A.data, convert(T, vl), convert(T, vh), 0, 0, -1.0)...)

"""
    eigen(A::Union{SymTridiagonal, Hermitian, Symmetric}, vl::Real, vu::Real) -> Eigen

Computes the eigenvalue decomposition of `A`, returning an [`Eigen`](@ref) factorization object `F`
which contains the eigenvalues in `F.values` and the eigenvectors in the columns of the
matrix `F.vectors`. (The `k`th eigenvector can be obtained from the slice `F.vectors[:, k]`.)

Iterating the decomposition produces the components `F.values` and `F.vectors`.

The following functions are available for `Eigen` objects: [`inv`](@ref), [`det`](@ref), and [`isposdef`](@ref).

`vl` is the lower bound of the window of eigenvalues to search for, and `vu` is the upper bound.

!!! note
    If [`vl`, `vu`] does not contain all eigenvalues of `A`, then the returned factorization
    will be a *truncated* factorization.
"""
function eigen(A::RealHermSymComplexHerm, vl::Real, vh::Real)
    T = eltype(A)
    S = eigtype(T)
    eigen!(S != T ? convert(AbstractMatrix{S}, A) : copy(A), vl, vh)
end

function eigvals!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}; sortby::Union{Function,Nothing}=nothing)
    vals = LAPACK.syevr!('N', 'A', A.uplo, A.data, 0.0, 0.0, 0, 0, -1.0)[1]
    !isnothing(sortby) && sort!(vals, by=sortby)
    return vals
end

function eigvals(A::RealHermSymComplexHerm; sortby::Union{Function,Nothing}=nothing)
    T = eltype(A)
    S = eigtype(T)
    eigvals!(S != T ? convert(AbstractMatrix{S}, A) : copy(A), sortby=sortby)
end

"""
    eigvals!(A::Union{SymTridiagonal, Hermitian, Symmetric}, irange::UnitRange) -> values

Same as [`eigvals`](@ref), but saves space by overwriting the input `A`, instead of creating a copy.
`irange` is a range of eigenvalue *indices* to search for - for instance, the 2nd to 8th eigenvalues.
"""
eigvals!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}, irange::UnitRange) =
    LAPACK.syevr!('N', 'I', A.uplo, A.data, 0.0, 0.0, irange.start, irange.stop, -1.0)[1]

"""
    eigvals(A::Union{SymTridiagonal, Hermitian, Symmetric}, irange::UnitRange) -> values

Returns the eigenvalues of `A`. It is possible to calculate only a subset of the
eigenvalues by specifying a [`UnitRange`](@ref) `irange` covering indices of the sorted eigenvalues,
e.g. the 2nd to 8th eigenvalues.

# Examples
```jldoctest
julia> A = SymTridiagonal([1.; 2.; 1.], [2.; 3.])
3×3 SymTridiagonal{Float64, Vector{Float64}}:
 1.0  2.0   ⋅
 2.0  2.0  3.0
  ⋅   3.0  1.0

julia> eigvals(A, 2:2)
1-element Vector{Float64}:
 0.9999999999999996

julia> eigvals(A)
3-element Vector{Float64}:
 -2.1400549446402604
  1.0000000000000002
  5.140054944640259
```
"""
function eigvals(A::RealHermSymComplexHerm, irange::UnitRange)
    T = eltype(A)
    S = eigtype(T)
    eigvals!(S != T ? convert(AbstractMatrix{S}, A) : copy(A), irange)
end

"""
    eigvals!(A::Union{SymTridiagonal, Hermitian, Symmetric}, vl::Real, vu::Real) -> values

Same as [`eigvals`](@ref), but saves space by overwriting the input `A`, instead of creating a copy.
`vl` is the lower bound of the interval to search for eigenvalues, and `vu` is the upper bound.
"""
eigvals!(A::RealHermSymComplexHerm{T,<:StridedMatrix}, vl::Real, vh::Real) where {T<:BlasReal} =
    LAPACK.syevr!('N', 'V', A.uplo, A.data, convert(T, vl), convert(T, vh), 0, 0, -1.0)[1]

"""
    eigvals(A::Union{SymTridiagonal, Hermitian, Symmetric}, vl::Real, vu::Real) -> values

Returns the eigenvalues of `A`. It is possible to calculate only a subset of the eigenvalues
by specifying a pair `vl` and `vu` for the lower and upper boundaries of the eigenvalues.

# Examples
```jldoctest
julia> A = SymTridiagonal([1.; 2.; 1.], [2.; 3.])
3×3 SymTridiagonal{Float64, Vector{Float64}}:
 1.0  2.0   ⋅
 2.0  2.0  3.0
  ⋅   3.0  1.0

julia> eigvals(A, -1, 2)
1-element Vector{Float64}:
 1.0000000000000009

julia> eigvals(A)
3-element Vector{Float64}:
 -2.1400549446402604
  1.0000000000000002
  5.140054944640259
```
"""
function eigvals(A::RealHermSymComplexHerm, vl::Real, vh::Real)
    T = eltype(A)
    S = eigtype(T)
    eigvals!(S != T ? convert(AbstractMatrix{S}, A) : copy(A), vl, vh)
end

eigmax(A::RealHermSymComplexHerm{<:Real,<:StridedMatrix}) = eigvals(A, size(A, 1):size(A, 1))[1]
eigmin(A::RealHermSymComplexHerm{<:Real,<:StridedMatrix}) = eigvals(A, 1:1)[1]

function eigen!(A::HermOrSym{T,S}, B::HermOrSym{T,S}; sortby::Union{Function,Nothing}=nothing) where {T<:BlasReal,S<:StridedMatrix}
    vals, vecs, _ = LAPACK.sygvd!(1, 'V', A.uplo, A.data, B.uplo == A.uplo ? B.data : copy(B.data'))
    GeneralizedEigen(sorteig!(vals, vecs, sortby)...)
end
function eigen!(A::Hermitian{T,S}, B::Hermitian{T,S}; sortby::Union{Function,Nothing}=nothing) where {T<:BlasComplex,S<:StridedMatrix}
    vals, vecs, _ = LAPACK.sygvd!(1, 'V', A.uplo, A.data, B.uplo == A.uplo ? B.data : copy(B.data'))
    GeneralizedEigen(sorteig!(vals, vecs, sortby)...)
end

function eigen!(A::RealHermSymComplexHerm{T,S}, B::AbstractMatrix{T}; sortby::Union{Function,Nothing}=nothing) where {T<:Number,S<:StridedMatrix}
    U = cholesky(B).U
    vals, w = eigen!(UtiAUi!(A, U))
    vecs = U \ w
    GeneralizedEigen(sorteig!(vals, vecs, sortby)...)
end

# Perform U' \ A / U in-place.
UtiAUi!(As::Symmetric, Utr::UpperTriangular) = Symmetric(_UtiAsymUi!(As.uplo, parent(As), parent(Utr)), sym_uplo(As.uplo))
UtiAUi!(As::Hermitian, Utr::UpperTriangular) = Hermitian(_UtiAsymUi!(As.uplo, parent(As), parent(Utr)), sym_uplo(As.uplo))
UtiAUi!(As::Symmetric, Udi::Diagonal) = Symmetric(_UtiAsymUi_diag!(As.uplo, parent(As), Udi), sym_uplo(As.uplo))
UtiAUi!(As::Hermitian, Udi::Diagonal) = Hermitian(_UtiAsymUi_diag!(As.uplo, parent(As), Udi), sym_uplo(As.uplo))

# U is upper triangular
function _UtiAsymUi!(uplo, A, U)
    n = size(A, 1)
    μ⁻¹ = 1 / U[1, 1]
    αμ⁻² = A[1, 1] * μ⁻¹' * μ⁻¹

    # Update (1, 1) element
    A[1, 1] = αμ⁻²
    if n > 1
        Unext = view(U, 2:n, 2:n)

        if uplo === 'U'
            # Update submatrix
            for j in 2:n, i in 2:j
                A[i, j] = (
                    A[i, j]
                    - μ⁻¹' * U[1, j] * A[1, i]'
                    - μ⁻¹ * A[1, j] * U[1, i]'
                    + αμ⁻² * U[1, j] * U[1, i]'
                )
            end

            # Update vector
            for j in 2:n
                A[1, j] = A[1, j] * μ⁻¹' - U[1, j] * αμ⁻²
            end
            ldiv!(view(A', 2:n, 1), UpperTriangular(Unext)', view(A', 2:n, 1))
        else
            # Update submatrix
            for j in 2:n, i in 2:j
                A[j, i] = (
                    A[j, i]
                    - μ⁻¹ * A[i, 1]' * U[1, j]'
                    - μ⁻¹' * U[1, i] * A[j, 1]
                    + αμ⁻² * U[1, i] * U[1, j]'
                )
            end

            # Update vector
            for j in 2:n
                A[j, 1] = A[j, 1] * μ⁻¹ - U[1, j]' * αμ⁻²
            end
            ldiv!(view(A, 2:n, 1), UpperTriangular(Unext)', view(A, 2:n, 1))
        end

        # Recurse
        _UtiAsymUi!(uplo, view(A, 2:n, 2:n), Unext)
    end

    return A
end

# U is diagonal
function _UtiAsymUi_diag!(uplo, A, U)
    n = size(A, 1)
    μ⁻¹ = 1 / U[1, 1]
    αμ⁻² = A[1, 1] * μ⁻¹' * μ⁻¹

    # Update (1, 1) element
    A[1, 1] = αμ⁻²
    if n > 1
        Unext = view(U, 2:n, 2:n)

        if uplo === 'U'
            # No need to update any submatrix when U is diagonal

            # Update vector
            for j in 2:n
                A[1, j] = A[1, j] * μ⁻¹'
            end
            ldiv!(view(A', 2:n, 1), Diagonal(Unext)', view(A', 2:n, 1))
        else
            # No need to update any submatrix when U is diagonal

            # Update vector
            for j in 2:n
                A[j, 1] = A[j, 1] * μ⁻¹
            end
            ldiv!(view(A, 2:n, 1), Diagonal(Unext)', view(A, 2:n, 1))
        end

        # Recurse
        _UtiAsymUi!(uplo, view(A, 2:n, 2:n), Unext)
    end

    return A
end

function eigvals!(A::HermOrSym{T,S}, B::HermOrSym{T,S}; sortby::Union{Function,Nothing}=nothing) where {T<:BlasReal,S<:StridedMatrix}
    vals = LAPACK.sygvd!(1, 'N', A.uplo, A.data, B.uplo == A.uplo ? B.data : copy(B.data'))[1]
    isnothing(sortby) || sort!(vals, by=sortby)
    return vals
end
function eigvals!(A::Hermitian{T,S}, B::Hermitian{T,S}; sortby::Union{Function,Nothing}=nothing) where {T<:BlasComplex,S<:StridedMatrix}
    vals = LAPACK.sygvd!(1, 'N', A.uplo, A.data, B.uplo == A.uplo ? B.data : copy(B.data'))[1]
    isnothing(sortby) || sort!(vals, by=sortby)
    return vals
end
eigvecs(A::HermOrSym) = eigvecs(eigen(A))

ext: jl

max_stars_repo_name: wentasah/julia

max_issues_repo_name: wentasah/julia

max_forks_repo_name: wentasah/julia


text:
using Base.LinAlg.BLAS: trmv, trmm, trsv, trsm

@unionise begin

"""
    DiagAffine{T<:AbstractVector} <: Invertible

DiagAffine transform with parametes `α` and `log(β)`. Defines function `f(z) = α + diag(β) * z`.
"""
struct DiagAffine{T<:AbstractVector} <: Invertible
    α::T
    logβ::T
    function DiagAffine(α::T, logβ::T) where {T}
        @assert length(α) == length(logβ)
        return new{T}(α, logβ)
    end
end
DiagAffine(α::T, logβ::T) where T<:Real = DiagAffine([α], [logβ])
function DiagAffine(θ::Vector, D::Int)
    @assert length(θ) == nparams(DiagAffine, D)
    return DiagAffine(θ[1:D], θ[D+1:2D])
end
dim(t::DiagAffine) = length(t.α)

"""
    apply(f::DiagAffine, z)

Compute the affine transform of `z` specified by `f`.
"""
function apply(f::DiagAffine, z::AbstractVecOrMat{<:Real})
    @assert length(f.α) == size(z, 1)
    return f.α .+ exp.(f.logβ) .* z
end

"""
    invert(f::DiagAffine, y)

Apply the inverse transform of `f` to `y` such that `invert(f, apply(f, z)) ≈ z` and
`apply(f, invert(f, z)) ≈ z`.
"""
function invert(f::DiagAffine, y::AbstractVecOrMat{<:Real})
    @assert dim(f) == size(y, 1)
    return (y .- f.α) ./ exp.(f.logβ)
end

function logdetJ(f::DiagAffine, z::AbstractVector{<:Real})
    @assert dim(f) == length(z)
    return sum(f.logβ)
end
function logdetJ(f::DiagAffine, z::AbstractMatrix{<:Real})
    @assert dim(f) == size(z, 1)
    return sum(f.logβ) .* ones(size(z, 2))
end

end # @unionise

params(f::DiagAffine) = [f.α, f.logβ]
nparams(::Type{<:DiagAffine}, D::Int) = 2D

function identity_init!(θ::AbstractVector{<:Real}, ::Type{<:DiagAffine}, ::AbstractRNG, D::Int)
    @assert length(θ) == nparams(DiagAffine, D)
    return fill!(θ, zero(eltype(θ)))
end

@unionise begin

"""
    Affine{TL<:RealMat, TU<:RealMat, Td′<:RealVec, Tb<:RealVec} <: Invertible

A dense affine transform. Parameterised in terms of the LDU decomposition, yielding
O(D^2) application and inversion, and O(D) Jacobian log determinant computation.
"""
struct Affine{TL<:RealMat, TU<:RealMat, Td<:RealVec, Tb<:RealVec} <: Invertible
    L::TL
    U::TU
    logd::Td
    b::Tb
    function Affine(L::TL, U::TU, logd::Td, b::Tb) where {TL, TU, Td, Tb}
        @assert size(L, 1) == size(L, 2)
        @assert size(L) == size(U)
        @assert length(logd) == length(b)
        return new{TL, TU, Td, Tb}(L, U, logd, b)
    end
end

dim(a::Affine) = length(a.b)
nparams(::Type{<:Affine}, D::Int) = 2D * (D + 1)
function Affine(θ::AbstractVector, D::Int)
    @assert length(θ) == nparams(Affine, D)
    L = reshape(θ[1:D^2], D, D)
    U = reshape(θ[D^2+1:2 * D^2], D, D)
    logd = θ[2 * D^2 + 1:2 * D^2 + D]
    b = θ[2 * D^2 + D + 1:nparams(Affine, D)]
    return Affine(L, U, logd, b)
end

function apply(f::Affine, z::AbstractVector{<:Real})
    @assert dim(f) == length(z)
    D = Diagonal(exp.(f.logd))
    return trmv('L', 'N', 'U', f.L, D * trmv('U', 'N', 'U', f.U, z)) .+ f.b
end

function apply(f::Affine, Z::AbstractMatrix{<:Real})
    @assert dim(f) == size(Z, 1)
    D = Diagonal(exp.(f.logd))
    DUδ = D * trmm('L', 'U', 'N', 'U', one(eltype(Z)), f.U, Z)
    return trmm('L', 'L', 'N', 'U', one(eltype(Z)), f.L, DUδ) .+ f.b
end

function invert(f::Affine, z::AbstractVector{<:Real})
    @assert dim(f) == length(z)
    D, δ = Diagonal(exp.(f.logd)), z - f.b
    return trsv('U', 'N', 'U', f.U, D \ trsv('L', 'N', 'U', f.L, δ))
end

function invert(f::Affine, Z::AbstractMatrix{<:Real})
    @assert dim(f) == size(Z, 1)
    D, δ = Diagonal(exp.(f.logd)), Z .- f.b
    tmp = D \ trsm('L', 'L', 'N', 'U', one(eltype(Z)), f.L, δ)
    return trsm('L', 'U', 'N', 'U', one(eltype(Z)), f.U, tmp)
end

function logdetJ(f::Affine, z::AbstractVector{<:Real})
    @assert dim(f) == length(z)
    return sum(f.logd)
end

function logdetJ(f::Affine, Z::AbstractMatrix{<:Real})
    @assert dim(f) == size(Z, 1)
    return sum(f.logd) .* ones(size(Z, 2))
end

end # @unionise

identity_init!(θ::AbstractVector{<:Real}, ::Type{<:Affine}, ::AbstractRNG, D::Int) =
    fill!(θ, zero(eltype(θ)))


text:
#
# Represent a symmetric banded matrix
# [ a_11 a_12 a_13
#   a_12 a_22 a_23 a_24
#   a_13 a_23 a_33 a_34
#        a_24 a_34 a_44  ]
# ordering the data like  (columns first)
#       [ *      *      a_13   a_24
#         *      a_12   a_23   a_34
#         a_11   a_22   a_33   a_44 ]
###

@inline function inbands_getindex(A::Symmetric{T, <:BandedMatrix}, k::Integer, j::Integer) where T
    P = parent(A)
    l,u = bandwidths(P)
    if -l ≤ abs(k-j) ≤ u
        parent(A).data[bandwidth(A) - abs(k-j) + 1, max(k,j)]
    else
        zero(T)
    end
end

# this is a hack but is much faster than default
function getindex(S::Symmetric{<:Any, <:BandedMatrix}, kr::AbstractUnitRange, jr::AbstractUnitRange)
    A = parent(S)
    m = max(last(kr), last(jr))
    B = if S.uplo == 'U'
        BandedMatrix(A[1:m,1:m],(0, bandwidth(A,2)))
    else
        BandedMatrix(A[1:m,1:m],(bandwidth(A,1),0))
    end
    ret = B + transpose(B)
    rdiv!(view(ret, band(0)), 2)
    ret[kr, jr]
end

symmetriclayout(::ML) where ML<:BandedColumns = SymmetricLayout{ML}()
symmetriclayout(::ML) where ML<:BandedRows = SymmetricLayout{ML}()

hermitianlayout(::Type{<:Complex}, ::ML) where ML<:BandedColumns = HermitianLayout{ML}()
hermitianlayout(::Type{<:Real}, ::ML) where ML<:BandedColumns = SymmetricLayout{ML}()
hermitianlayout(::Type{<:Complex}, ::ML) where ML<:BandedRows = HermitianLayout{ML}()
hermitianlayout(::Type{<:Real}, ::ML) where ML<:BandedRows = SymmetricLayout{ML}()

sublayout(::SymmetricLayout{<:AbstractBandedLayout}, ::Type{<:NTuple{2,AbstractUnitRange}}) = BandedLayout()
sublayout(::HermitianLayout{<:AbstractBandedLayout}, ::Type{<:NTuple{2,AbstractUnitRange}}) = BandedLayout()

isbanded(A::HermOrSym) = isbanded(parent(A))

bandwidth(A::HermOrSym) = ifelse(symmetricuplo(A) == 'U', bandwidth(parent(A),2), bandwidth(parent(A),1))
bandwidths(A::HermOrSym) = (bandwidth(A), bandwidth(A))

function symbandeddata(A)
    B = symmetricdata(A)
    l,u = bandwidths(B)
    D = bandeddata(B)
    if symmetricuplo(A) == 'U'
        view(D, 1:u+1, :)
    else
        m = size(D,1)
        view(D, u+1:u+l+1, :)
    end
end

function hermbandeddata(A)
    B = hermitiandata(A)
    l,u = bandwidths(B)
    D = bandeddata(B)
    if symmetricuplo(A) == 'U'
        view(D, 1:u+1, :)
    else
        m = size(D,1)
        view(D, u+1:u+l+1, :)
    end
end

banded_sbmv!(uplo, α::T, A::AbstractMatrix{T}, x::AbstractVector{T}, β::T, y::AbstractVector{T}) where {T<:BlasFloat} =
    BLAS.sbmv!(uplo, bandwidth(A), α, symbandeddata(A), x, β, y)

@inline function _banded_sbmv!(tA, α, A, x, β, y)
    if x ≡ y
        banded_sbmv!(tA, α, A, copy(x), β, y)
    else
        banded_sbmv!(tA, α, A, x, β, y)
    end
end

function materialize!(M::BlasMatMulVecAdd{<:SymmetricLayout{<:BandedColumnMajor},<:AbstractStridedLayout,<:AbstractStridedLayout})
    α, A, x, β, y = M.α, M.A, M.B, M.β, M.C
    m, n = size(A)
    m == n || throw(DimensionMismatch("matrix is not square"))
    (length(y) ≠ m || length(x) ≠ n) && throw(DimensionMismatch("*"))
    l = bandwidth(A)
    l ≥ 0 || return lmul!(β, y)
    _banded_sbmv!(symmetricuplo(A), α, A, x, β, y)
end

banded_hbmv!(uplo, α::T, A::AbstractMatrix{T}, x::AbstractVector{T}, β::T, y::AbstractVector{T}) where {T<:BlasFloat} =
    BLAS.hbmv!(uplo, bandwidth(A), α, hermbandeddata(A), x, β, y)

@inline function _banded_hbmv!(tA, α, A, x, β, y)
    if x ≡ y
        banded_hbmv!(tA, α, A, copy(x), β, y)
    else
        banded_hbmv!(tA, α, A, x, β, y)
    end
end

function materialize!(M::BlasMatMulVecAdd{<:HermitianLayout{<:BandedColumnMajor},<:AbstractStridedLayout,<:AbstractStridedLayout})
    α, A, x, β, y = M.α, M.A, M.B, M.β, M.C
    m, n = size(A)
    m == n || throw(DimensionMismatch("matrix is not square"))
    (length(y) ≠ m || length(x) ≠ n) && throw(DimensionMismatch("*"))
    l = bandwidth(A)
    l ≥ 0 || return lmul!(β, y)
    _banded_hbmv!(symmetricuplo(A), α, A, x, β, y)
end

## eigvals routine

function _tridiagonalize!(A::AbstractMatrix{T}, ::SymmetricLayout{<:BandedColumnMajor}) where T
    n=size(A, 1)
    d = Vector{T}(undef,n)
    e = Vector{T}(undef,n-1)
    Q = Matrix{T}(undef,0,0)
    work = Vector{T}(undef,n)
    sbtrd!('N', symmetricuplo(A), size(A,1), bandwidth(A), symbandeddata(A), d, e, Q, work)
    SymTridiagonal(d,e)
end

tridiagonalize!(A::AbstractMatrix) = _tridiagonalize!(A, MemoryLayout(typeof(A)))

eigvals(A::Symmetric{T,<:BandedMatrix{T}}) where T<:Base.IEEEFloat = eigvals!(copy(A))
eigvals(A::Symmetric{T,<:BandedMatrix{T}}) where T<:Real = eigvals!(tridiagonalize(A))
eigvals(A::Hermitian{T,<:BandedMatrix{T}}) where T<:Real = eigvals!(tridiagonalize(A))
eigvals(A::Hermitian{T,<:BandedMatrix{T}}) where T<:Complex = eigvals!(tridiagonalize(A))

eigvals!(A::Symmetric{T,<:BandedMatrix{T}}) where T <: Real = eigvals!(tridiagonalize!(A))
function eigvals!(A::Symmetric{T,<:BandedMatrix{T}}, B::Symmetric{T,<:BandedMatrix{T}}) where T<:Real
    n = size(A, 1)
    @assert n == size(B, 1)
    @assert A.uplo == B.uplo
    # compute split-Cholesky factorization of B.
    kb = bandwidth(B)
    B_data = symbandeddata(B)
    pbstf!(B.uplo, n, kb, B_data)
    # convert to a regular symmetric eigenvalue problem.
    ka = bandwidth(A)
    A_data = symbandeddata(A)
    X = Array{T}(undef,0,0)
    work = Vector{T}(undef,2n)
    sbgst!('N', A.uplo, n, ka, kb, A_data, B_data, X, work)
    # compute eigenvalues of symmetric eigenvalue problem.
    eigvals!(A)
end

function eigvals(A::Symmetric{<:Any,<:BandedMatrix}, B::Symmetric{<:Any,<:BandedMatrix})
    AA = if bandwidth(A) >= bandwidth(B)
        copy(A)
    else
        copyto!(similar(B), A)
    end
    eigvals!(AA, copy(B))
end


text:
function solve()
    r = parse(Int, readline())
    2π*r
end

println(solve())

max_stars_repo_name: aishikawa/atcoder-julia

max_issues_repo_name: aishikawa/atcoder-julia

max_forks_repo_name: aishikawa/atcoder-julia


text:
import Adapt
using OffsetArrays

# Adapt an offset CuArray to work nicely with CUDA kernels.
Adapt.adapt_structure(to, x::OffsetArray) = OffsetArray(Adapt.adapt(to, parent(x)), x.offsets)

# Need to adapt SubArray indices as well.
# See: https://github.com/JuliaGPU/Adapt.jl/issues/16
#Adapt.adapt_structure(to, A::SubArray{<:Any,<:Any,AT}) where {AT} =
#    SubArray(adapt(to, parent(A)), adapt.(Ref(to), parentindices(A)))


text:
"""
  `unit_square(n::Int64)`

Set up a n-by-n quasi-uniform mesh for the unit square.
"""
function unit_square(n::Int64)
  if(n<2)
    n = 2
  end
  nnodes = n*n
  nedges = 4*(n-1)
  nelems = 2*(n-1)*(n-1)
  h = 1/(n-1)

  Nodes = Array{Array{Float64, 1}, 1}(undef, nnodes)
  Edges = Array{Array{Int64,1},1}(undef, nedges)
  Triangles = Array{Array{Int64,1},1}(undef, nelems)
  Volumes = Dict{Int64,Set{Int64}}()
  Boundaries = Dict{Int64, Boundary}()
  Boundaries[1001] = Boundary(Set{Int64}(), Set{Int64}())
  Boundaries[1002] = Boundary(Set{Int64}(), Set{Int64}())
  Boundaries[1003] = Boundary(Set{Int64}(), Set{Int64}())
  Boundaries[1004] = Boundary(Set{Int64}(), Set{Int64}())

  k = 1
  for i=1:n
    for j=1:n
      Nodes[k] = [(j-1)*h; (i-1)*h]
      k = k+1
    end
  end

  k = 1
  for i=1:n-1
    for j=1:n-1
      Triangles[k] = [(i-1)*n + j; (i-1)*n + j + 1; i*n + j]
      k = k+1

      Triangles[k] = [(i-1)*n + j + 1; i*n + j + 1; i*n + j]
      k = k+1
    end
  end

  for j=1:n
    push!(Boundaries[1001].Nodes, j)
    push!(Boundaries[1002].Nodes, j + (n-1)*n)
    push!(Boundaries[1003].Nodes, (j-1)*n+1)
    push!(Boundaries[1004].Nodes, (j-1)*n+n)
  end

  k = 1
  for j=1:n-1
    Edges[k] =  [j, j+1];
    push!(Boundaries[1001].Edges, k)
    k = k+1

    Edges[k] =  [j+1 + (n-1)*n, j + (n-1)*n];
    push!(Boundaries[1002].Edges, k)
    k = k+1

    Edges[k] =  [j*n+1, (j-1)*n+1];
    push!(Boundaries[1003].Edges, k)
    k = k+1

    Edges[k] =  [(j-1)*n+n, j*n+n];
    push!(Boundaries[1004].Edges, k)
    k = k+1
  end

  Volumes[10001] = Set{Int64}(1:nnodes)

  return Mesh(nnodes, nelems, nedges, Nodes, Triangles, Edges, Boundaries, Volumes)
end

"""
  `function import_mesh(file_name::String)`

Import a gmsh file of version v2 or v4.
"""
function import_mesh(file_name::String)
  f = open(file_name)

  while(!eof(f) && (l=readline(f)) != "\$MeshFormat")
  end
  l=readline(f)
  a = split(l, " ")
  version = parse(Float64, a[1])
  if(version >= 2.0 && version <3.0)
    mesh = import_mesh2(f)
  elseif(version >= 4.1 && version <5.0)
    mesh = import_mesh4(f)
  else
    println("Unsupported mesh format: " * string(parse(Float64, a[1])))
    println("msh2 is recommended.")
    return
  end
  close(f)
  return mesh
end

function import_mesh2(f::IOStream)

  while(!eof(f) && (l=readline(f)) != "\$Nodes")
  end
  l=readline(f)
  nnodes = parse(Int64, l)
  Nodes = zeros(nnodes)
  Nodes = Array{Array{Float64, 1}, 1}(undef, nnodes)

  for i=1:nnodes
    l = readline(f)
    a = split(l, " ")
    Nodes[i] = [parse(Float64, a[2]), parse(Float64, a[3])]
  end
  while(!eof(f) && (l=readline(f)) != "\$Elements")
  end
  l=readline(f)
  nelems = parse(Int64, l)

  Triangles = Set(Array{Int64}[])
  Edges = Set(Array{Int64}[])
  for i=1:nelems
    l = readline(f)
    a = split(l, " ")
    if(parse(Int64, a[2]) == 1)
      push!(Edges, [parse(Int64, a[4]), parse(Int64, a[6]),
                    parse(Int64, a[7])])
    else
      push!(Triangles, [parse(Int64, a[4]), parse(Int64, a[6]),
                        parse(Int64, a[7]), parse(Int64, a[8])])
    end

  end

  _Triangles = Array{Array{Int64,1},1}(undef,length(Triangles))
  _Edges = Array{Array{Int64,1},1}(undef,length(Edges))

  Volumes = Dict{Int64,Set{Int64}}()
  for (i,t) in enumerate(Triangles)
    _Triangles[i] = copy(t[2:end])
    if( !in(t[1],keys(Volumes)) )
      Volumes[t[1]] = Set{Int64}()
    end
    push!(Volumes[t[1]], i)
  end

  Boundaries = Dict{Int64, Boundary}()
  for (i,el) in enumerate(Edges)
    _Edges[i] = copy(el[2:end])
    if( !in(el[1],keys(Boundaries)) )
      Boundaries[el[1]] = Boundary(Set{Int64}(), Set{Int64}())
    end
    push!(Boundaries[el[1]].Edges, i)
    push!(Boundaries[el[1]].Nodes, el[2])
    push!(Boundaries[el[1]].Nodes, el[3])
  end

  return Mesh(nnodes, length(Triangles), length(Edges), Nodes, _Triangles, _Edges, Boundaries, Volumes)
end

function import_mesh4(f::IOStream)

  # 0,1,2,3 dimensional entity tags
  tags = [Dict{Int64,Int64}(), Dict{Int64,Int64}(),
          Dict{Int64,Int64}(), Dict{Int64,Int64}()]
  while(!eof(f) && (l=readline(f)) != "\$Entities")
  end
  l=readline(f)
  a=split(l, " ")
  numTags = [parse(Int64, a[1]), parse(Int64, a[2]),
             parse(Int64, a[3]), parse(Int64, a[4])]

  # Point tags
  for j=1:numTags[1]
    l=readline(f)
    a=split(l, " ")
    if(parse(Int64, a[4])!=0)
      tags[1][parse(Int64, a[1])] = parse(Int64, a[5])
    end
  end

  # Curve, Surface, Volume tags
  for i=2:4
    for j=1:numTags[i]
      l=readline(f)
      a=split(l, " ")
      if(parse(Int64, a[8])!=0)
        tags[i][parse(Int64, a[1])] = parse(Int64, a[9])
      end
    end
  end

  while(!eof(f) && (l=readline(f)) != "\$Nodes")
  end
  l=readline(f)
  a=split(l, " ")
  blocks = parse(Int64, a[1])
  nnodes = parse(Int64, a[2])

  Nodes = Array{Array{Float64, 1}, 1}(undef, nnodes)
  NodeNumbering = Dict{Int64, Int64}()
  n=1
  m=1
  for i=1:blocks
    l = readline(f)
    a = split(l, " ")
    nodesInBlock = parse(Int64, a[4])

    # The node numbers
    for j=1:nodesInBlock
      l = readline(f)
      a = split(l, " ")
      NodeNumbering[parse(Int64, a[1])] = n
      n+=1
    end

    # The actual coordinates
    for j=1:nodesInBlock
      l = readline(f)
      a = split(l, " ")
      Nodes[m] = [parse(Float64, a[1]), parse(Float64, a[2])]
      m+=1
    end
  end

  while(!eof(f) && (l=readline(f)) != "\$Elements")
  end

  l=readline(f)
  a=split(l, " ")
  blocks = parse(Int64, a[1])

  Triangles = Set(Array{Int64}[])
  Edges = Set(Array{Int64}[])
  for i=1:blocks
    l = readline(f)
    a = split(l, " ")
    elemDim = parse(Int64, a[1])
    elemEntitiy = parse(Int64, a[2])
    elemType = parse(Int64, a[3])
    elemsInBlock = parse(Int64, a[4])
    for j=1:elemsInBlock
      l = readline(f)
      a = split(l, " ")
      if(elemType == 1)
        push!(Edges, [tags[elemDim+1][elemEntitiy], parse(Int64, a[2]),
                      parse(Int64, a[3])])
      elseif(elemType == 2)
        push!(Triangles, [tags[elemDim+1][elemEntitiy], parse(Int64, a[2]),
                          parse(Int64, a[3]), parse(Int64, a[4])])
      else
        println("Not supported element tpye", elemType)
      end
    end
  end

  _Triangles = Array{Array{Int64,1},1}(undef,length(Triangles))
  _Edges = Array{Array{Int64,1},1}(undef,length(Edges))

  Volumes = Dict{Int64,Set{Int64}}()
  for (i,t) in enumerate(Triangles)
    _Triangles[i] = [NodeNumbering[n] for n in t[2:end]]
    if( !in(t[1],keys(Volumes)) )
      Volumes[t[1]] = Set{Int64}()
    end
    push!(Volumes[t[1]], i)
  end

  Boundaries = Dict{Int64, Boundary}()
  for (i,el) in enumerate(Edges)
    _Edges[i] = [NodeNumbering[n] for n in el[2:end]]
    if( !in(el[1],keys(Boundaries)) )
      Boundaries[el[1]] = Boundary(Set{Int64}(), Set{Int64}())
    end
    push!(Boundaries[el[1]].Edges, i)
    push!(Boundaries[el[1]].Nodes, NodeNumbering[el[2]])
    push!(Boundaries[el[1]].Nodes, NodeNumbering[el[3]])
  end

  return Mesh(nnodes, length(Triangles), length(Edges), Nodes, _Triangles, _Edges, Boundaries, Volumes)
end

function Jacobian(v1::Array{Float64,1}, v2::Array{Float64,1}, v3::Array{Float64,1})
  J = [v2-v1 v3-v1]
  return det(J), inv(J)'
end

function Jacobian(mesh::Mesh, elem::Int64)
  t = mesh.Triangles[elem]
  return Jacobian(mesh.Nodes[t[1]], mesh.Nodes[t[2]], mesh.Nodes[t[3]])
end

function EdgeJacobian(mesh::Mesh, elem::Int64)
  el = mesh.Edges[elem]
  return norm(mesh.Nodes[el[1]] - mesh.Nodes[el[2]])
end

function GetBoundaryNodes(mesh::Mesh, marker::Int64)
  return collect(mesh.Boundaries[marker].Nodes)
end

function getCellVolumes(mesh::Mesh)
  nelems = mesh.nelems
  v = zeros(nelems)
  for el=1:nelems
    nodes = mesh.Triangles[el]
    (detJ, J) = Jacobian(mesh, el)
    v[el] = sum(quadW)*detJ
  end
  return v
end

"""
  `function getCellDiameter(mesh::Mesh)`

Return a vector of the cell diameter, i.e. the longest edges length.
"""
function getCellDiameter(mesh::Mesh)
  nelems = mesh.nelems
  v = zeros(nelems)
  for el=1:nelems
    nodes = mesh.Nodes[mesh.Triangles[el]]
    v[el] = maximum([norm(nodes[3]-nodes[1]); norm(nodes[2]-nodes[1]); norm(nodes[3]-nodes[2])])
  end
  return v
end

"""
  `function getMeshBoundingBox(mesh::Mesh)`

Return two nodes, which span the bounding box of the mesh.
"""
function getMeshBoundingBox(mesh::Mesh)
  xmin = Inf
  ymin = Inf
  xmax = -Inf
  ymax = -Inf
  for v in mesh.Nodes
    if v[1] < xmin
      xmin = v[1]
    elseif v[1] > xmax
      xmax = v[1]
    end
    if v[2] < ymin
      ymin = v[2]
    elseif v[2] > ymax
      ymax = v[2]
    end
  end
  Array[[xmin;ymin],[xmax;ymax]]
end

"""
  `function open_vtk_file(mesh::Mesh, file_name::String)`

Open a new VTK output file and write the mesh data into it.
"""
function open_vtk_file(mesh::Mesh, file_name::String)
  points = zeros(Float64, length(mesh.Nodes[1]), length(mesh.Nodes))
  for (i,p) in enumerate(mesh.Nodes)
    points[:,i] = copy(p)
  end

  cells = Array{WriteVTK.MeshCell,1}(undef, mesh.nelems)
  for (i,t) in enumerate(mesh.Triangles)
    cells[i] = WriteVTK.MeshCell(WriteVTK.VTKCellTypes.VTK_TRIANGLE, t)
  end

  return WriteVTK.vtk_grid(file_name, points, cells)
end

"""
  `function write_point_data(vtkfile, data, data_name::String)`

Add a new point data field with a name to an existing VTK file.
"""
function write_point_data(vtkfile, data, data_name::String)
  WriteVTK.vtk_point_data(vtkfile, data, data_name)
end

"""
  `function write_cell_data(vtkfile, data, data_name::String)`

Add a new cell data field with a name to an existing VTK file.
"""
function write_cell_data(vtkfile, data, data_name::String)
  WriteVTK.vtk_cell_data(vtkfile, data, data_name)
end

"""
  `function save_vtk_file(vtkfile)`

Finalize a VTK file by writing all data to disk.
"""
function save_vtk_file(vtkfile)
  WriteVTK.vtk_save(vtkfile)
end