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

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

Accepts an Amazon Macie membership invitation that was received from a specific account.

# Arguments
- `invitation_id`: The unique identifier for the invitation to accept.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"administratorAccountId"`: The Amazon Web Services account ID for the account that sent
  the invitation.
- `"masterAccount"`: (Deprecated) The Amazon Web Services account ID for the account that
  sent the invitation. This property has been replaced by the administratorAccountId property
  and is retained only for backward compatibility.
"""
accept_invitation(invitationId; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/invitations/accept", Dict{String, Any}("invitationId"=>invitationId); aws_config=aws_config)
accept_invitation(invitationId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/invitations/accept", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("invitationId"=>invitationId), params)); aws_config=aws_config)

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

Retrieves information about one or more custom data identifiers.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ids"`: An array of strings that lists the unique identifiers for the custom data
  identifiers to retrieve information about.
"""
batch_get_custom_data_identifiers(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers/get"; aws_config=aws_config)
batch_get_custom_data_identifiers(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers/get", params; aws_config=aws_config)

"""
    create_classification_job(client_token, job_type, name, s3_job_definition)
    create_classification_job(client_token, job_type, name, s3_job_definition, params::Dict{String,<:Any})

 Creates and defines the settings for a classification job.

# Arguments
- `client_token`: A unique, case-sensitive token that you provide to ensure the idempotency
  of the request.
- `job_type`: The schedule for running the job. Valid values are: ONE_TIME - Run the job
  only once. If you specify this value, don't specify a value for the scheduleFrequency
  property. SCHEDULED - Run the job on a daily, weekly, or monthly basis. If you specify this
  value, use the scheduleFrequency property to define the recurrence pattern for the job.
- `name`: A custom name for the job. The name can contain as many as 500 characters.
- `s3_job_definition`: The S3 buckets that contain the objects to analyze, and the scope of
  that analysis.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"customDataIdentifierIds"`: The custom data identifiers to use for data analysis and
  classification.
- `"description"`: A custom description of the job. The description can contain as many as
  200 characters.
- `"initialRun"`: Specifies whether to analyze all existing, eligible objects immediately
  after the job is created.
- `"samplingPercentage"`: The sampling depth, as a percentage, to apply when processing
  objects. This value determines the percentage of eligible objects that the job analyzes. If
  this value is less than 100, Amazon Macie selects the objects to analyze at random, up to
  the specified percentage, and analyzes all the data in those objects.
- `"scheduleFrequency"`: The recurrence pattern for running the job. To run the job only
  once, don't specify a value for this property and set the value for the jobType property to
  ONE_TIME.
- `"tags"`: A map of key-value pairs that specifies the tags to associate with the job. A
  job can have a maximum of 50 tags. Each tag consists of a tag key and an associated tag
  value. The maximum length of a tag key is 128 characters. The maximum length of a tag value
  is 256 characters.
"""
create_classification_job(clientToken, jobType, name, s3JobDefinition; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/jobs", Dict{String, Any}("clientToken"=>clientToken, "jobType"=>jobType, "name"=>name, "s3JobDefinition"=>s3JobDefinition); aws_config=aws_config)
create_classification_job(clientToken, jobType, name, s3JobDefinition, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/jobs", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "jobType"=>jobType, "name"=>name, "s3JobDefinition"=>s3JobDefinition), params)); aws_config=aws_config)

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

Creates and defines the criteria and other settings for a custom data identifier.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive token that you provide to ensure the
  idempotency of the request.
- `"description"`: A custom description of the custom data identifier. The description can
  contain as many as 512 characters. We strongly recommend that you avoid including any
  sensitive data in the description of a custom data identifier. Other users of your account
  might be able to see the identifier's description, depending on the actions that they're
  allowed to perform in Amazon Macie.
- `"ignoreWords"`: An array that lists specific character sequences (ignore words) to
  exclude from the results. If the text matched by the regular expression is the same as any
  string in this array, Amazon Macie ignores it. The array can contain as many as 10 ignore
  words. Each ignore word can contain 4-90 characters. Ignore words are case sensitive.
- `"keywords"`: An array that lists specific character sequences (keywords), one of which
  must be within proximity (maximumMatchDistance) of the regular expression to match. The
  array can contain as many as 50 keywords. Each keyword can contain 3-90 characters.
  Keywords aren't case sensitive.
- `"maximumMatchDistance"`: The maximum number of characters that can exist between text
  that matches the regex pattern and the character sequences specified by the keywords array.
  Macie includes or excludes a result based on the proximity of a keyword to text that
  matches the regex pattern. The distance can be 1-300 characters. The default value is 50.
- `"name"`: A custom name for the custom data identifier. The name can contain as many as
  128 characters. We strongly recommend that you avoid including any sensitive data in the
  name of a custom data identifier. Other users of your account might be able to see the
  identifier's name, depending on the actions that they're allowed to perform in Amazon Macie.
- `"regex"`: The regular expression (regex) that defines the pattern to match. The
  expression can contain as many as 512 characters.
- `"tags"`: A map of key-value pairs that specifies the tags to associate with the custom
  data identifier. A custom data identifier can have a maximum of 50 tags. Each tag consists
  of a tag key and an associated tag value. The maximum length of a tag key is 128
  characters. The maximum length of a tag value is 256 characters.
"""
create_custom_data_identifier(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers", Dict{String, Any}("clientToken"=>string(uuid4())); aws_config=aws_config)
create_custom_data_identifier(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    create_findings_filter(action, finding_criteria, name)
    create_findings_filter(action, finding_criteria, name, params::Dict{String,<:Any})

Creates and defines the criteria and other settings for a findings filter.

# Arguments
- `action`: The action to perform on findings that meet the filter criteria
  (findingCriteria). Valid values are: ARCHIVE, suppress (automatically archive) the
  findings; and, NOOP, don't perform any action on the findings.
- `finding_criteria`: The criteria to use to filter findings.
- `name`: A custom name for the filter. The name must contain at least 3 characters and can
  contain as many as 64 characters. We strongly recommend that you avoid including any
  sensitive data in the name of a filter. Other users of your account might be able to see
  the filter's name, depending on the actions that they're allowed to perform in Amazon Macie.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive token that you provide to ensure the
  idempotency of the request.
- `"description"`: A custom description of the filter. The description can contain as many
  as 512 characters. We strongly recommend that you avoid including any sensitive data in the
  description of a filter. Other users of your account might be able to see the filter's
  description, depending on the actions that they're allowed to perform in Amazon Macie.
- `"position"`: The position of the filter in the list of saved filters on the Amazon Macie
  console. This value also determines the order in which the filter is applied to findings,
  relative to other filters that are also applied to the findings.
- `"tags"`: A map of key-value pairs that specifies the tags to associate with the filter.
  A findings filter can have a maximum of 50 tags. Each tag consists of a tag key and an
  associated tag value. The maximum length of a tag key is 128 characters. The maximum length
  of a tag value is 256 characters.
"""
create_findings_filter(action, findingCriteria, name; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findingsfilters", Dict{String, Any}("action"=>action, "findingCriteria"=>findingCriteria, "name"=>name, "clientToken"=>string(uuid4())); aws_config=aws_config)
create_findings_filter(action, findingCriteria, name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findingsfilters", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("action"=>action, "findingCriteria"=>findingCriteria, "name"=>name, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Sends an Amazon Macie membership invitation to one or more accounts.

# Arguments
- `account_ids`: An array that lists Amazon Web Services account IDs, one for each account
  to send the invitation to.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"disableEmailNotification"`: Specifies whether to send an email notification to the root
  user of each account that the invitation will be sent to. This notification is in addition
  to an alert that the root user receives in Personal Health Dashboard. To send an email
  notification to the root user of each account, set this value to true.
- `"message"`: A custom message to include in the invitation. Amazon Macie adds this
  message to the standard content that it sends for an invitation.
"""
create_invitations(accountIds; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/invitations", Dict{String, Any}("accountIds"=>accountIds); aws_config=aws_config)
create_invitations(accountIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/invitations", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("accountIds"=>accountIds), params)); aws_config=aws_config)

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

Associates an account with an Amazon Macie administrator account.

# Arguments
- `account`: The details of the account to associate with the administrator account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"tags"`: A map of key-value pairs that specifies the tags to associate with the account
  in Amazon Macie. An account can have a maximum of 50 tags. Each tag consists of a tag key
  and an associated tag value. The maximum length of a tag key is 128 characters. The maximum
  length of a tag value is 256 characters.
"""
create_member(account; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/members", Dict{String, Any}("account"=>account); aws_config=aws_config)
create_member(account, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/members", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("account"=>account), params)); aws_config=aws_config)

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

Creates sample findings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingTypes"`: An array that lists one or more types of findings to include in the set
  of sample findings. Currently, the only supported value is
  Policy:IAMUser/S3BucketEncryptionDisabled.
"""
create_sample_findings(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings/sample"; aws_config=aws_config)
create_sample_findings(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings/sample", params; aws_config=aws_config)

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

Declines Amazon Macie membership invitations that were received from specific accounts.

# Arguments
- `account_ids`: An array that lists Amazon Web Services account IDs, one for each account
  that sent an invitation to decline.

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

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

Soft deletes a custom data identifier.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
delete_custom_data_identifier(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/custom-data-identifiers/$(id)"; aws_config=aws_config)
delete_custom_data_identifier(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/custom-data-identifiers/$(id)", params; aws_config=aws_config)

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

Deletes a findings filter.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
delete_findings_filter(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/findingsfilters/$(id)"; aws_config=aws_config)
delete_findings_filter(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/findingsfilters/$(id)", params; aws_config=aws_config)

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

Deletes Amazon Macie membership invitations that were received from specific accounts.

# Arguments
- `account_ids`: An array that lists Amazon Web Services account IDs, one for each account
  that sent an invitation to delete.

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

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

Deletes the association between an Amazon Macie administrator account and an account.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
delete_member(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/members/$(id)"; aws_config=aws_config)
delete_member(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/members/$(id)", params; aws_config=aws_config)

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

 Retrieves (queries) statistical data and other information about one or more S3 buckets
that Amazon Macie monitors and analyzes.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"criteria"`: The criteria to use to filter the query results.
- `"maxResults"`: The maximum number of items to include in each page of the response. The
  default value is 50.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
- `"sortCriteria"`: The criteria to use to sort the query results.
"""
describe_buckets(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/datasources/s3"; aws_config=aws_config)
describe_buckets(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/datasources/s3", params; aws_config=aws_config)

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

Retrieves the status and settings for a classification job.

# Arguments
- `job_id`: The unique identifier for the classification job.

"""
describe_classification_job(jobId; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/jobs/$(jobId)"; aws_config=aws_config)
describe_classification_job(jobId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/jobs/$(jobId)", params; aws_config=aws_config)

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

Retrieves the Amazon Macie configuration settings for an Amazon Web Services organization.

"""
describe_organization_configuration(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/admin/configuration"; aws_config=aws_config)
describe_organization_configuration(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/admin/configuration", params; aws_config=aws_config)

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

Disables an Amazon Macie account and deletes Macie resources for the account.

"""
disable_macie(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/macie"; aws_config=aws_config)
disable_macie(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("DELETE", "/macie", 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 account as the delegated Amazon Macie administrator account for an Amazon Web
Services organization.

# Arguments
- `admin_account_id`: The Amazon Web Services account ID of the delegated Amazon Macie
  administrator account.

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

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

Disassociates a member account from its Amazon Macie administrator account.

"""
disassociate_from_administrator_account(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/administrator/disassociate"; aws_config=aws_config)
disassociate_from_administrator_account(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/administrator/disassociate", params; aws_config=aws_config)

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

(Deprecated) Disassociates a member account from its Amazon Macie administrator account.
This operation has been replaced by the DisassociateFromAdministratorAccount operation.

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

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

Disassociates an Amazon Macie administrator account from a member account.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
disassociate_member(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/members/disassociate/$(id)"; aws_config=aws_config)
disassociate_member(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/members/disassociate/$(id)", params; aws_config=aws_config)

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

Enables Amazon Macie and specifies the configuration settings for a Macie account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive token that you provide to ensure the
  idempotency of the request.
- `"findingPublishingFrequency"`: Specifies how often to publish updates to policy findings
  for the account. This includes publishing updates to Security Hub and Amazon EventBridge
  (formerly called Amazon CloudWatch Events).
- `"status"`: Specifies the new status for the account. To enable Amazon Macie and start
  all Macie activities for the account, set this value to ENABLED.
"""
enable_macie(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/macie", Dict{String, Any}("clientToken"=>string(uuid4())); aws_config=aws_config)
enable_macie(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/macie", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Designates an account as the delegated Amazon Macie administrator account for an Amazon Web
Services organization.

# Arguments
- `admin_account_id`: The Amazon Web Services account ID for the account to designate as
  the delegated Amazon Macie administrator account for the organization.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive token that you provide to ensure the
  idempotency of the request.
"""
enable_organization_admin_account(adminAccountId; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/admin", Dict{String, Any}("adminAccountId"=>adminAccountId, "clientToken"=>string(uuid4())); aws_config=aws_config)
enable_organization_admin_account(adminAccountId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/admin", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("adminAccountId"=>adminAccountId, "clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Retrieves information about the Amazon Macie administrator account for an account.

"""
get_administrator_account(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/administrator"; aws_config=aws_config)
get_administrator_account(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/administrator", params; aws_config=aws_config)

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

 Retrieves (queries) aggregated statistical data for all the S3 buckets that Amazon Macie
monitors and analyzes.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"accountId"`: The unique identifier for the Amazon Web Services account.
"""
get_bucket_statistics(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/datasources/s3/statistics"; aws_config=aws_config)
get_bucket_statistics(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/datasources/s3/statistics", params; aws_config=aws_config)

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

Retrieves the configuration settings for storing data classification results.

"""
get_classification_export_configuration(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/classification-export-configuration"; aws_config=aws_config)
get_classification_export_configuration(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/classification-export-configuration", params; aws_config=aws_config)

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

Retrieves the criteria and other settings for a custom data identifier.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
get_custom_data_identifier(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/custom-data-identifiers/$(id)"; aws_config=aws_config)
get_custom_data_identifier(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/custom-data-identifiers/$(id)", params; aws_config=aws_config)

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

 Retrieves (queries) aggregated statistical data about findings.

# Arguments
- `group_by`: The finding property to use to group the query results. Valid values are:
  classificationDetails.jobId - The unique identifier for the classification job that
  produced the finding. resourcesAffected.s3Bucket.name - The name of the S3 bucket that the
  finding applies to. severity.description - The severity level of the finding, such as High
  or Medium. type - The type of finding, such as Policy:IAMUser/S3BucketPublic and
  SensitiveData:S3Object/Personal.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingCriteria"`: The criteria to use to filter the query results.
- `"size"`: The maximum number of items to include in each page of the response.
- `"sortCriteria"`: The criteria to use to sort the query results.
"""
get_finding_statistics(groupBy; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings/statistics", Dict{String, Any}("groupBy"=>groupBy); aws_config=aws_config)
get_finding_statistics(groupBy, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings/statistics", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("groupBy"=>groupBy), params)); aws_config=aws_config)

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

Retrieves the details of one or more findings.

# Arguments
- `finding_ids`: An array of strings that lists the unique identifiers for the findings to
  retrieve.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"sortCriteria"`: The criteria for sorting the results of the request.
"""
get_findings(findingIds; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings/describe", Dict{String, Any}("findingIds"=>findingIds); aws_config=aws_config)
get_findings(findingIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings/describe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("findingIds"=>findingIds), params)); aws_config=aws_config)

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

Retrieves the criteria and other settings for a findings filter.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
get_findings_filter(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/findingsfilters/$(id)"; aws_config=aws_config)
get_findings_filter(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/findingsfilters/$(id)", params; aws_config=aws_config)

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

Retrieves the configuration settings for publishing findings to Security Hub.

"""
get_findings_publication_configuration(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/findings-publication-configuration"; aws_config=aws_config)
get_findings_publication_configuration(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/findings-publication-configuration", params; aws_config=aws_config)

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

Retrieves the count of Amazon Macie membership invitations that were received by an account.

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

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

Retrieves the current status and configuration settings for an Amazon Macie account.

"""
get_macie_session(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/macie"; aws_config=aws_config)
get_macie_session(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/macie", params; aws_config=aws_config)

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

(Deprecated) Retrieves information about the Amazon Macie administrator account for an
account. This operation has been replaced by the GetAdministratorAccount operation.

"""
get_master_account(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/master"; aws_config=aws_config)
get_master_account(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/master", params; aws_config=aws_config)

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

Retrieves information about an account that's associated with an Amazon Macie administrator
account.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

"""
get_member(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/members/$(id)"; aws_config=aws_config)
get_member(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/members/$(id)", params; aws_config=aws_config)

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

Retrieves (queries) quotas and aggregated usage data for one or more accounts.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filterBy"`: An array of objects, one for each condition to use to filter the query
  results. If you specify more than one condition, Amazon Macie uses an AND operator to join
  the conditions.
- `"maxResults"`: The maximum number of items to include in each page of the response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
- `"sortBy"`: The criteria to use to sort the query results.
- `"timeRange"`: The inclusive time period to query usage data for. Valid values are:
  MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding
  30 days. If you don't specify a value, Amazon Macie provides usage data for the preceding
  30 days.
"""
get_usage_statistics(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/usage/statistics"; aws_config=aws_config)
get_usage_statistics(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/usage/statistics", params; aws_config=aws_config)

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

Retrieves (queries) aggregated usage data for an account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"timeRange"`: The inclusive time period to retrieve the data for. Valid values are:
  MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding
  30 days. If you don't specify a value for this parameter, Amazon Macie provides aggregated
  usage data for the preceding 30 days.
"""
get_usage_totals(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/usage"; aws_config=aws_config)
get_usage_totals(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/usage", params; aws_config=aws_config)

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

Retrieves a subset of information about one or more classification jobs.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filterCriteria"`: The criteria to use to filter the results.
- `"maxResults"`: The maximum number of items to include in each page of the response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
- `"sortCriteria"`: The criteria to use to sort the results.
"""
list_classification_jobs(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/jobs/list"; aws_config=aws_config)
list_classification_jobs(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/jobs/list", params; aws_config=aws_config)

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

Retrieves a subset of information about all the custom data identifiers for an account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of items to include in each page of the response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
"""
list_custom_data_identifiers(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers/list"; aws_config=aws_config)
list_custom_data_identifiers(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers/list", params; aws_config=aws_config)

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

Retrieves a subset of information about one or more findings.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingCriteria"`: The criteria to use to filter the results.
- `"maxResults"`: The maximum number of items to include in each page of the response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
- `"sortCriteria"`: The criteria to use to sort the results.
"""
list_findings(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings"; aws_config=aws_config)
list_findings(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/findings", params; aws_config=aws_config)

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

Retrieves a subset of information about all the findings filters for an account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of items to include in each page of a paginated
  response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
"""
list_findings_filters(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/findingsfilters"; aws_config=aws_config)
list_findings_filters(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/findingsfilters", params; aws_config=aws_config)

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

Retrieves information about all the Amazon Macie membership invitations that were received
by an account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of items to include in each page of a paginated
  response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
"""
list_invitations(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/invitations"; aws_config=aws_config)
list_invitations(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/invitations", params; aws_config=aws_config)

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

Retrieves information about the accounts that are associated with an Amazon Macie
administrator account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of items to include in each page of a paginated
  response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
- `"onlyAssociated"`: Specifies which accounts to include in the response, based on the
  status of an account's relationship with the administrator account. By default, the
  response includes only current member accounts. To include all accounts, set this value to
  false.
"""
list_members(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/members"; aws_config=aws_config)
list_members(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/members", params; aws_config=aws_config)

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

Retrieves information about the delegated Amazon Macie administrator account for an Amazon
Web Services organization.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of items to include in each page of a paginated
  response.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
"""
list_organization_admin_accounts(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/admin"; aws_config=aws_config)
list_organization_admin_accounts(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("GET", "/admin", params; aws_config=aws_config)

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

Retrieves the tags (keys and values) that are associated with a classification job, custom
data identifier, findings filter, or member account.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the classification job, custom data
  identifier, findings filter, or member account.

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

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

Creates or updates the configuration settings for storing data classification results.

# Arguments
- `configuration`: The location to store data classification results in, and the encryption
  settings to use when storing results in that location.

"""
put_classification_export_configuration(configuration; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PUT", "/classification-export-configuration", Dict{String, Any}("configuration"=>configuration); aws_config=aws_config)
put_classification_export_configuration(configuration, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PUT", "/classification-export-configuration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("configuration"=>configuration), params)); aws_config=aws_config)

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

Updates the configuration settings for publishing findings to Security Hub.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"clientToken"`: A unique, case-sensitive token that you provide to ensure the
  idempotency of the request.
- `"securityHubConfiguration"`: The configuration settings that determine which findings to
  publish to Security Hub.
"""
put_findings_publication_configuration(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PUT", "/findings-publication-configuration", Dict{String, Any}("clientToken"=>string(uuid4())); aws_config=aws_config)
put_findings_publication_configuration(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PUT", "/findings-publication-configuration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Retrieves (queries) statistical data and other information about Amazon Web Services
resources that Amazon Macie monitors and analyzes.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"bucketCriteria"`: The filter conditions that determine which S3 buckets to include or
  exclude from the query results.
- `"maxResults"`: The maximum number of items to include in each page of the response. The
  default value is 50.
- `"nextToken"`: The nextToken string that specifies which page of results to return in a
  paginated response.
- `"sortCriteria"`: The criteria to use to sort the results.
"""
search_resources(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/datasources/search-resources"; aws_config=aws_config)
search_resources(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/datasources/search-resources", params; aws_config=aws_config)

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

Adds or updates one or more tags (keys and values) that are associated with a
classification job, custom data identifier, findings filter, or member account.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the classification job, custom data
  identifier, findings filter, or member account.
- `tags`: A map of key-value pairs that specifies the tags to associate with the resource.
  A resource can have a maximum of 50 tags. Each tag consists of a tag key and an associated
  tag value. The maximum length of a tag key is 128 characters. The maximum length of a tag
  value is 256 characters.

"""
tag_resource(resourceArn, tags; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("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()) = macie2("POST", "/tags/$(resourceArn)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("tags"=>tags), params)); aws_config=aws_config)

"""
    test_custom_data_identifier(regex, sample_text)
    test_custom_data_identifier(regex, sample_text, params::Dict{String,<:Any})

Tests a custom data identifier.

# Arguments
- `regex`: The regular expression (regex) that defines the pattern to match. The expression
  can contain as many as 512 characters.
- `sample_text`: The sample text to inspect by using the custom data identifier. The text
  can contain as many as 1,000 characters.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ignoreWords"`: An array that lists specific character sequences (ignore words) to
  exclude from the results. If the text matched by the regular expression is the same as any
  string in this array, Amazon Macie ignores it. The array can contain as many as 10 ignore
  words. Each ignore word can contain 4-90 characters. Ignore words are case sensitive.
- `"keywords"`: An array that lists specific character sequences (keywords), one of which
  must be within proximity (maximumMatchDistance) of the regular expression to match. The
  array can contain as many as 50 keywords. Each keyword can contain 3-90 characters.
  Keywords aren't case sensitive.
- `"maximumMatchDistance"`: The maximum number of characters that can exist between text
  that matches the regex pattern and the character sequences specified by the keywords array.
  Macie includes or excludes a result based on the proximity of a keyword to text that
  matches the regex pattern. The distance can be 1-300 characters. The default value is 50.
"""
test_custom_data_identifier(regex, sampleText; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers/test", Dict{String, Any}("regex"=>regex, "sampleText"=>sampleText); aws_config=aws_config)
test_custom_data_identifier(regex, sampleText, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("POST", "/custom-data-identifiers/test", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("regex"=>regex, "sampleText"=>sampleText), params)); aws_config=aws_config)

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

Removes one or more tags (keys and values) from a classification job, custom data
identifier, findings filter, or member account.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the classification job, custom data
  identifier, findings filter, or member account.
- `tag_keys`: The key of the tag to remove from the resource. To remove multiple tags,
  append the tagKeys parameter and argument for each additional tag to remove, separated by
  an ampersand (&).

"""
untag_resource(resourceArn, tagKeys; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("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()) = macie2("DELETE", "/tags/$(resourceArn)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("tagKeys"=>tagKeys), params)); aws_config=aws_config)

"""
    update_classification_job(job_id, job_status)
    update_classification_job(job_id, job_status, params::Dict{String,<:Any})

Changes the status of a classification job.

# Arguments
- `job_id`: The unique identifier for the classification job.
- `job_status`: The new status for the job. Valid values are: CANCELLED - Stops the job
  permanently and cancels it. This value is valid only if the job's current status is IDLE,
  PAUSED, RUNNING, or USER_PAUSED. If you specify this value and the job's current status is
  RUNNING, Amazon Macie immediately begins to stop all processing tasks for the job. You
  can't resume or restart a job after you cancel it. RUNNING - Resumes the job. This value is
  valid only if the job's current status is USER_PAUSED. If you paused the job while it was
  actively running and you specify this value less than 30 days after you paused the job,
  Macie immediately resumes processing from the point where you paused the job. Otherwise,
  Macie resumes the job according to the schedule and other settings for the job. USER_PAUSED
  - Pauses the job temporarily. This value is valid only if the job's current status is IDLE,
  PAUSED, or RUNNING. If you specify this value and the job's current status is RUNNING,
  Macie immediately begins to pause all processing tasks for the job. If you pause a one-time
  job and you don't resume it within 30 days, the job expires and Macie cancels the job. If
  you pause a recurring job when its status is RUNNING and you don't resume it within 30
  days, the job run expires and Macie cancels the run. To check the expiration date, refer to
  the UserPausedDetails.jobExpiresAt property.

"""
update_classification_job(jobId, jobStatus; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/jobs/$(jobId)", Dict{String, Any}("jobStatus"=>jobStatus); aws_config=aws_config)
update_classification_job(jobId, jobStatus, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/jobs/$(jobId)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("jobStatus"=>jobStatus), params)); aws_config=aws_config)

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

Updates the criteria and other settings for a findings filter.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"action"`: The action to perform on findings that meet the filter criteria
  (findingCriteria). Valid values are: ARCHIVE, suppress (automatically archive) the
  findings; and, NOOP, don't perform any action on the findings.
- `"clientToken"`: A unique, case-sensitive token that you provide to ensure the
  idempotency of the request.
- `"description"`: A custom description of the filter. The description can contain as many
  as 512 characters. We strongly recommend that you avoid including any sensitive data in the
  description of a filter. Other users might be able to see the filter's description,
  depending on the actions that they're allowed to perform in Amazon Macie.
- `"findingCriteria"`: The criteria to use to filter findings.
- `"name"`: A custom name for the filter. The name must contain at least 3 characters and
  can contain as many as 64 characters. We strongly recommend that you avoid including any
  sensitive data in the name of a filter. Other users might be able to see the filter's name,
  depending on the actions that they're allowed to perform in Amazon Macie.
- `"position"`: The position of the filter in the list of saved filters on the Amazon Macie
  console. This value also determines the order in which the filter is applied to findings,
  relative to other filters that are also applied to the findings.
"""
update_findings_filter(id; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/findingsfilters/$(id)", Dict{String, Any}("clientToken"=>string(uuid4())); aws_config=aws_config)
update_findings_filter(id, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/findingsfilters/$(id)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>string(uuid4())), params)); aws_config=aws_config)

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

Suspends or re-enables an Amazon Macie account, or updates the configuration settings for a
Macie account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"findingPublishingFrequency"`: Specifies how often to publish updates to policy findings
  for the account. This includes publishing updates to Security Hub and Amazon EventBridge
  (formerly called Amazon CloudWatch Events).
- `"status"`: Specifies a new status for the account. Valid values are: ENABLED, resume all
  Amazon Macie activities for the account; and, PAUSED, suspend all Macie activities for the
  account.
"""
update_macie_session(; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/macie"; aws_config=aws_config)
update_macie_session(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/macie", params; aws_config=aws_config)

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

Enables an Amazon Macie administrator to suspend or re-enable a member account.

# Arguments
- `id`: The unique identifier for the Amazon Macie resource or account that the request
  applies to.
- `status`: Specifies the new status for the account. Valid values are: ENABLED, resume all
  Amazon Macie activities for the account; and, PAUSED, suspend all Macie activities for the
  account.

"""
update_member_session(id, status; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/macie/members/$(id)", Dict{String, Any}("status"=>status); aws_config=aws_config)
update_member_session(id, status, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/macie/members/$(id)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("status"=>status), params)); aws_config=aws_config)

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

Updates the Amazon Macie configuration settings for an Amazon Web Services organization.

# Arguments
- `auto_enable`: Specifies whether to enable Amazon Macie automatically for each account,
  when the account is added to the Amazon Web Services organization.

"""
update_organization_configuration(autoEnable; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/admin/configuration", Dict{String, Any}("autoEnable"=>autoEnable); aws_config=aws_config)
update_organization_configuration(autoEnable, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = macie2("PATCH", "/admin/configuration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("autoEnable"=>autoEnable), params)); aws_config=aws_config)


text:
using ITensors,
  ITensorGPU,
  LinearAlgebra, # For tr()
  CUDA,
  Test

# gpu tests!
@testset "cutrunctate" begin
  @testset for T in (Float32, Float64)
    @test ITensorGPU.truncate!(CUDA.zeros(T, 10)) == (zero(T), zero(T), CUDA.zeros(T, 1))
    trunc = ITensorGPU.truncate!(
      CuArray(T[1.0, 0.5, 0.4, 0.1, 0.05]); absoluteCutoff=true, cutoff=T(0.2)
    )
    @test trunc[1] ≈ T(0.15)
    @test trunc[2] ≈ T(0.25)
    @test Array(trunc[3]) == T[1.0, 0.5, 0.4]
    trunc = ITensorGPU.truncate!(
      CuArray(T[0.4, 0.26, 0.19, 0.1, 0.05]); relativeCutoff=true, cutoff=T(0.2)
    )
    @test trunc[1] ≈ T(0.15)
    @test trunc[2] ≈ T(0.145)
    @test Array(trunc[3]) == T[0.4, 0.26, 0.19]
    trunc = ITensorGPU.truncate!(
      CuArray(convert(Vector{T}, [0.4, 0.26, 0.19, 0.1, 0.05] / 2));
      relativeCutoff=true,
      cutoff=T(0.2),
    )
    @test trunc[1] ≈ T(0.15)
    @test trunc[2] ≈ T(0.145 / 2)
    @test Array(trunc[3]) == convert(Vector{T}, [0.4, 0.26, 0.19] / 2)
  end
end # End truncate test

ext: jl


text:
using PyPlot
using OffsetArrays
"""
Program to solve 2D lid driven cavity steady flow problem
"""
# Initial settings
xmin = 0.0
xmax = 1.0
ymin = 0.0
ymax = 1.0

global u_lid = 1.0
global Re = 100.0

#Total points in each direction
nx = 101
ny = 101

global dx = (xmax - xmin) / (nx - 1)
global dy = (ymax - ymin) / (ny - 1)

cfl = 0.2

#
# We are using Staggered grid
#

#u,v needs ghosts
uloc = OffsetArray(zeros(nx, ny + 1, 2), 0:nx-1, 0:ny, 1:2)
vloc = OffsetArray(zeros(nx + 1, ny, 2), 0:nx, 0:ny-1, 1:2)

# p needs ghost cells
global ploc = OffsetArray(zeros(nx + 1, ny + 1, 2), 0:nx, 0:ny, 1:2)

# Get the locations for debugging purposes
for i = 0:nx-1
    for j = 1:ny-1
        uloc[i, j, 1] = xmin + (i) * dx           #x loc
        uloc[i, j, 2] = ymin + dy / 2 + (j - 1) * dy  #y loc
    end
end

for i = 1:nx-1
    for j = 0:ny-1
        vloc[i, j, 1] = xmin + dx / 2 + (i - 1) * dx
        vloc[i, j, 2] = ymin + (j) * dy
    end
end

# Allocate arrays for storage
u = OffsetArray(zeros(nx, ny + 1), 0:nx-1, 0:ny)
v = OffsetArray(zeros(nx + 1, ny), 0:nx, 0:ny-1)
p = OffsetArray(zeros(nx + 1, ny + 1), 0:nx, 0:ny)

uα = OffsetArray(zeros(nx, ny + 1), 0:nx-1, 0:ny)
vα = OffsetArray(zeros(nx + 1, ny), 0:nx, 0:ny-1)

#Initialize arrays
u .= 0.0
v .= 0.0
p .= 0.0

uα .= 0.0
vα .= 0.0

#Function to calculate dt
function calc_dt(u, v, dx, dy, cfl)
    umax = maximum(u)
    vmax = maximum(v)
    dt = minimum([cfl * dx / umax, cfl * dy / vmax])
    return dt
end

#Function for expbc
function expbc!(u, v, p)
    #Lower BC
    u[:, 0] = -u[:, 1]
    v[:, 0] .= 0.0
    p[:, 0] = p[:, 1]

    #Upper BC
    u[:, end] = 2 * u_lid .- u[:, end-1]
    v[:, end] .= 0.0
    p[:, end] = p[:, end-1]

    #Left BC
    u[0, :] .= 0.0
    v[0, :] = -v[1, :]
    p[0, :] = p[1, :]

    #Right BC
    u[end, :] .= 0.0
    v[end, :] = -v[end-1, :]
    p[end, :] = p[end-1, :]

    return nothing
end

#Function find uα and vα
function predictor!(u, v, dt, uα, vα)
    #calculate u_approx
    for i = 1:nx-2
        for j = 1:ny-1
            u1 = -0.5 * (u[i+1, j]^2 - u[i-1, j]^2) / (dx)

            u21 = (u[i, j+1] + u[i, j]) * (v[i, j] + v[i+1, j])
            u22 = (u[i, j] + u[i, j-1]) * (v[i, j-1] + v[i+1, j-1])
            u2 = -0.25 * (u21 - u22) / dy

            u31 = (u[i+1, j] - 2 * u[i, j] + u[i-1, j]) / (dx^2)
            u32 = (u[i, j+1] - 2 * u[i, j] + u[i, j+1]) / (dy^2)
            u3 = 1 / Re * (u31 + u32)

            uα[i, j] = u[i, j] + dt * (u1 + u2 + u3)
        end
    end

    #calculate v_approx
    for i = 1:nx-1
        for j = 1:ny-2
            v11 = (u[i, j+1] + u[i, j]) * (v[i, j] + v[i+1, j])
            v12 = (u[i-1, j+1] + u[i-1, j]) * (v[i, j] + v[i-1, j])
            v1 = -0.25 * (v11 - v12) / dx

            v2 = -0.5 * (v[i, j+1^2] - v[i, j-1]^2) / dy

            v31 = (v[i, j+1] - 2 * v[i, j] + v[i, j-1]) / (dy^2)
            v32 = (v[i+1, j] - 2 * v[i, j] + v[i-1, j]) / (dx^2)
            v3 = 1 / Re * (v31 + v32)

            vα[i, j] = v[i, j] + dt * (v1 + v2 + v3)
        end
    end

    #Function for expbc
    #Lower BC
    uα[:, 0] = -uα[:, 1]
    vα[:, 0] .= 0.0

    #Upper BC
    uα[:, end] = 2 * u_lid .- uα[:, end-1]
    vα[:, end] .= 0.0

    #Left BC
    uα[0, :] .= 0.0
    vα[0, :] = -vα[1, :]

    #Right BC
    uα[end, :] .= 0.0
    vα[end, :] = -vα[end-1, :]

    return nothing
end

#Function for pressure solver- Gauss Seidel
function psolve!(uα, vα, dt, p)
    tol = 1.0E-4
    nmax = 10
    for n = 1:nmax
        for i = 1:nx-1
            for j = 1:ny-1
                rhs =
                    0.5 / dt * ((uα[i, j] - uα[i-1, j]) / dx + (vα[i, j] - vα[i, j-1]) / dy)
                p[i, j] =
                    -0.5 / (1 / dx^2 + 1 / dy^2) * (
                        rhs - 1 / dx^2 * (p[i+1, j] + p[i-1, j]) -
                        1 / dy^2 * (p[i, j+1] + p[i, j-1])
                    )
            end
        end

    end

    return nothing
end

#Function for corrector
function corrector!(u, v, uα, vα, p, dt)

    #calculate u_approx
    for i = 1:nx-2
        for j = 1:ny-1
            u[i, j] = uα[i, j] - dt / dx * (p[i+1, j] - p[i, j])
        end
    end

    #calculate v_approx
    for i = 1:nx-1
        for j = 1:ny-2
            v[i, j] = vα[i, j] - dt / dy * (p[i, j+1] - p[i, j])
        end
    end

    return nothing
end

function main(nmax)
    for n = 1:nmax
        println(n)
        expbc!(u, v, p)
        dt = calc_dt(u, v, dx, dy, cfl)
        predictor!(u, v, dt, uα, vα)
        expbc!(uα, vα, p)
        psolve!(uα, vα, dt, p)
        expbc!(uα, vα, p)
        corrector!(u, v, uα, vα, p, dt)
    end
    return nothing
end
#%%
@btime main(10)
contourf(transpose(u), levels = 10)


text:
# # Time Series Analysis
# A time series is a sequence of data points, each associated with a time. In our example, we will work with a time series of daily temperatures in the city of Melbourne, Australia over a period of a few years. Let $x$ be the vector of the time series, and $x_i$ denote the temperature in Melbourne on day $i$. Here is a picture of the time series:

using Plots, Convex, ECOS, DelimitedFiles
aux(str) = joinpath(@__DIR__, "aux_files", str) # path to auxiliary files

temps = readdlm(aux("melbourne_temps.txt"), ',')
n = size(temps, 1)
plot(1:n, temps[1:n], ylabel="Temperature (°C)", label="data", xlabel = "Time (days)", xticks=0:365:n)

# We can quickly compute the mean of the time series to be $11.2$. If we were to always guess the mean as the temperature of Melbourne on a given day, the RMS error of our guesswork would be $4.1$. We'll try to lower this RMS error by coming up with better ways to model the temperature than guessing the mean.
#
# A simple way to model this time series would be to find a smooth curve that approximates the yearly ups and downs.
# We can represent this model as a vector $s$ where $s_i$ denotes the temperature on the $i$-th day.
# To force this trend to repeat yearly, we simply want
#
# $$
#  s_i = s_{i + 365}
# $$
#
# for each applicable $i$.
#
# We also want our model to have two more properties:
#
# - The first is that the temperature on each day in our model should be relatively close to the actual temperature of that day.
# - The second is that our model needs to be smooth, so the change in temperature from day to day should be relatively small. The following objective would capture both properties:
#
# $$
#  \sum_{i = 1}^n (s_i - x_i)^2 + \lambda \sum_{i = 2}^n(s_i - s_{i - 1})^2
# $$
#
# where $\lambda$ is the smoothing parameter. The larger $\lambda$ is, the smoother our model will be.
#
# The following code uses Convex to find and plot the model:

yearly = Variable(n)
eq_constraints = [ yearly[i] == yearly[i - 365] for i in 365 + 1 : n ]

smoothing = 100
smooth_objective = sumsquares(yearly[1 : n - 1] - yearly[2 : n])
problem = minimize(sumsquares(temps - yearly) + smoothing * smooth_objective, eq_constraints);
solve!(problem, () -> ECOS.Optimizer(maxit=200, verbose=0))
residuals = temps - evaluate(yearly)

## Plot smooth fit
plot(1:n, temps[1:n], label="data")
plot!(1:n, evaluate(yearly)[1:n], linewidth=2, label="smooth fit",  ylabel="Temperature (°C)", xticks=0:365:n, xlabel="Time (days)")

# We can also plot the residual temperatures, $r$, defined as $r = x - s$.

## Plot residuals for a few days
plot(1:100, residuals[1:100], ylabel="Residuals", xlabel="Time (days)")

#-

root_mean_square_error = sqrt(sum( x -> x^2, residuals) / length(residuals))
# Our smooth model has a RMS error of $2.7$, a significant improvement from just guessing the mean, but we can do better.
#
# We now make the hypothesis that the residual temperature on a given day is some linear combination of the previous $5$ days. Such a model is called autoregressive. We are essentially trying to fit the residuals as a function of other parts of the data itself. We want to find a vector of coefficients $a$ such that
#
# $$
#  \text{r}(i) \approx \sum_{j = 1}^5 a_j \text{r}(i - j)
# $$
#
# This can be done by simply minimizing the following sum of squares objective
#
# $$
#  \sum_{i = 6}^n \left(\text{r}(i) - \sum_{j = 1}^5 a_j \text{r}(i - j)\right)^2
# $$
#
# The following Convex code solves this problem and plots our autoregressive model against the actual residual temperatures:

## Generate the residuals matrix
ar_len = 5

residuals_mat = Matrix{Float64}(undef, length(residuals) - ar_len, ar_len)
for i = 1:ar_len
  residuals_mat[:, i] = residuals[ar_len - i + 1 : n - i]
end

## Solve autoregressive problem
ar_coef = Variable(ar_len)
problem = minimize(sumsquares(residuals_mat * ar_coef - residuals[ar_len + 1 : end]))
solve!(problem, () -> ECOS.Optimizer(max_iters=200, verbose=0))

## plot autoregressive fit of daily fluctuations for a few days
ar_range = 1:145
day_range = ar_range .+ ar_len
plot(day_range, residuals[day_range], label="fluctuations from smooth fit", ylabel="Temperature difference (°C)")
plot!(day_range, residuals_mat[ar_range, :] * evaluate(ar_coef), label="autoregressive estimate", xlabel="Time (days)")

# Now, we can add our autoregressive model for the residual temperatures to our smooth model to get an better fitting model for the daily temperatures in the city of Melbourne:

total_estimate = evaluate(yearly)
total_estimate[ar_len + 1 : end] += residuals_mat * evaluate(ar_coef)

# We can plot the final fit of data across the whole time range:
plot(1:n, temps, label="data", ylabel="Temperature (°C)")
plot!(1:n, total_estimate, label="estimate", xticks=0:365:n, xlabel="Time (days)")

# The RMS error of this final model is $\sim 2.3$:
root_mean_square_error = sqrt(sum( x -> x^2, total_estimate - temps) / length(temps))


text:
using Flux
println("NNPDE_tests")
using DiffEqFlux
println("Starting Soon!")
using ModelingToolkit
using DiffEqBase
using Test, NeuralPDE
println("Starting Soon!")
using GalacticOptim
using Optim
using Quadrature,Cubature, Cuba
using QuasiMonteCarlo
using SciMLBase

using Random
Random.seed!(100)

cb = function (p,l)
    println("Current loss is: $l")
    return false
end

## Example 1, 1D ode
println("Example 1, 1D ode")
@parameters θ
@variables u(..)
Dθ = Differential(θ)

# 1D ODE
eq = Dθ(u(θ)) ~ θ^3 + 2*θ + (θ^2)*((1+3*(θ^2))/(1+θ+(θ^3))) - u(θ)*(θ + ((1+3*(θ^2))/(1+θ+θ^3)))

# Initial and boundary conditions
bcs = [u(0.) ~ 1.0]

# Space and time domains
domains = [θ ∈ IntervalDomain(0.0,1.0)]
# Discretization
dt = 0.1
# Neural network
chain = FastChain(FastDense(1,12,Flux.σ),FastDense(12,1))

strategy = NeuralPDE.QuadratureTraining()
discretization = NeuralPDE.PhysicsInformedNN(chain,
                                             strategy;
                                             init_params = nothing,
                                             phi = nothing,
                                             derivative = nothing,
                                             )

pde_system = PDESystem(eq,bcs,domains,[θ],[u])
prob = NeuralPDE.discretize(pde_system,discretization)

res = GalacticOptim.solve(prob, ADAM(0.1); cb = cb, maxiters=1000)
prob2 = remake(prob,u0=res.minimizer)
res = GalacticOptim.solve(prob2, ADAM(0.001); cb = cb, maxiters=1000)
phi = discretization.phi

analytic_sol_func(t) = exp(-(t^2)/2)/(1+t+t^3) + t^2
ts = [domain.domain.lower:dt/10:domain.domain.upper for domain in domains][1]
u_real  = [analytic_sol_func(t) for t in ts]
u_predict  = [first(phi(t,res.minimizer)) for t in ts]

@test u_predict ≈ u_real atol = 0.2

# using Plots
# t_plot = collect(ts)
# plot(t_plot ,u_real)
# plot!(t_plot ,u_predict)

## Example 2, 2D Poisson equation
function test_2d_poisson_equation(chain_, strategy_)
    println("Example 2, 2D Poisson equation, chain: $(typeof(chain)), strategy: $strategy_")
    @parameters x y
    @variables u(..)
    Dxx = Differential(x)^2
    Dyy = Differential(y)^2

    # 2D PDE
    eq  = Dxx(u(x,y)) + Dyy(u(x,y)) ~ -sin(pi*x)*sin(pi*y)

    # Initial and boundary conditions
    bcs = [u(0,y) ~ 0.f0, u(1,y) ~ -sin(pi*1)*sin(pi*y),
           u(x,0) ~ 0.f0, u(x,1) ~ -sin(pi*x)*sin(pi*1)]
    # Space and time domains
    domains = [x ∈ IntervalDomain(0.0,1.0),
               y ∈ IntervalDomain(0.0,1.0)]

    # chain = FastChain(FastDense(2,12,Flux.σ),FastDense(12,12,Flux.σ),FastDense(12,1))
    discretization = NeuralPDE.PhysicsInformedNN(chain_,
                                                 strategy_)

    pde_system = PDESystem(eq,bcs,domains,[x,y],[u])
    prob = NeuralPDE.discretize(pde_system,discretization)

    res = GalacticOptim.solve(prob, ADAM(0.1); cb = cb, maxiters=500)
    phi = discretization.phi

    dx = 0.1
    xs,ys = [domain.domain.lower:dx/10:domain.domain.upper for domain in domains]
    analytic_sol_func(x,y) = (sin(pi*x)*sin(pi*y))/(2pi^2)

    u_predict = reshape([first(phi([x,y],res.minimizer)) for x in xs for y in ys],(length(xs),length(ys)))
    u_real = reshape([analytic_sol_func(x,y) for x in xs for y in ys], (length(xs),length(ys)))
    diff_u = abs.(u_predict .- u_real)

    @test u_predict ≈ u_real atol = 3.0

    # p1 = plot(xs, ys, u_real, linetype=:contourf,title = "analytic");
    # p2 = plot(xs, ys, u_predict, linetype=:contourf,title = "predict");
    # p3 = plot(xs, ys, diff_u,linetype=:contourf,title = "error");
    # plot(p1,p2,p3)
end

# Discretization
dx = 0.1
grid_strategy = NeuralPDE.GridTraining(dx)
fastchain = FastChain(FastDense(2,12,Flux.σ),FastDense(12,12,Flux.σ),FastDense(12,1))
fluxchain = Chain(Dense(2,12,Flux.σ),Dense(12,12,Flux.σ),Dense(12,1))
chains = [fluxchain, fastchain]
for chain in chains
    test_2d_poisson_equation(chain, grid_strategy)
end

stochastic_strategy = NeuralPDE.StochasticTraining(100) #points
quadrature_strategy = NeuralPDE.QuadratureTraining(quadrature_alg=HCubatureJL(),
                                                   reltol = 1e-2, abstol = 1e-2,
                                                   maxiters = 50)
quasirandom_strategy = NeuralPDE.QuasiRandomTraining(100; #points
                                                     sampling_alg = UniformSample(),
                                                     minibatch = 100)

strategies = [stochastic_strategy, quadrature_strategy,quasirandom_strategy]
for strategy_ in strategies
    chain_ = FastChain(FastDense(2,12,Flux.σ),FastDense(12,12,Flux.σ),FastDense(12,1))
    test_2d_poisson_equation(chain_, strategy_)
end

function run_2d_poisson_equation(strategy_)
    @parameters x y
    @variables u(..)
    Dxx = Differential(x)^2
    Dyy = Differential(y)^2

    # 2D PDE
    eq  = Dxx(u(x,y)) + Dyy(u(x,y)) ~ -sin(pi*x)*sin(pi*y)

    # Initial and boundary conditions
    bcs = [u(0,y) ~ 0.f0, u(1,y) ~ -sin(pi*1)*sin(pi*y),
           u(x,0) ~ 0.f0, u(x,1) ~ -sin(pi*x)*sin(pi*1)]
    # Space and time domains
    domains = [x ∈ IntervalDomain(0.0,1.0),
               y ∈ IntervalDomain(0.0,1.0)]
    # Discretization
    dx = 0.1

    chain = FastChain(FastDense(2,4,Flux.σ),FastDense(4,1))

    discretization = NeuralPDE.PhysicsInformedNN(chain,
                                                 strategy_)

    pde_system = PDESystem(eq,bcs,domains,[x,y],[u])
    prob = NeuralPDE.discretize(pde_system,discretization)

    res = GalacticOptim.solve(prob, ADAM(0.01); cb = cb,  maxiters=5)
end

algs = [HCubatureJL(), CubatureJLh(), CubatureJLp(),CubaCuhre()]
for alg in algs
    strategy_ =  NeuralPDE.QuadratureTraining(quadrature_alg = alg,reltol=1e-8,abstol=1e-8,maxiters=30)
    run_2d_poisson_equation(strategy_)
end

## Example 3, high-order ode
println("Example 3, high-order ode")
@parameters x
@variables u(..)
Dxxx = Differential(x)^3
Dx = Differential(x)

# ODE
eq = Dxxx(u(x)) ~ cos(pi*x)

# Initial and boundary conditions
bcs = [u(0.) ~ 0.0,
       u(1.) ~ cos(pi),
       Dx(u(1.)) ~ 1.0]

# Space and time domains
domains = [x ∈ IntervalDomain(0.0,1.0)]

# Discretization
dx = 0.05

# Neural network
chain = FastChain(FastDense(1,8,Flux.σ),FastDense(8,1))

discretization = NeuralPDE.PhysicsInformedNN(chain,NeuralPDE.GridTraining(dx))
pde_system = PDESystem(eq,bcs,domains,[x],[u])
prob = NeuralPDE.discretize(pde_system,discretization)

res = GalacticOptim.solve(prob, ADAM(0.1); cb = cb, maxiters=200)
prob = remake(prob,u0=res.minimizer)
res = GalacticOptim.solve(prob, ADAM(0.01); cb = cb, maxiters=800)
prob = remake(prob,u0=res.minimizer)
res = GalacticOptim.solve(prob, ADAM(0.001); cb = cb, maxiters=400)
phi = discretization.phi

analytic_sol_func(x) = (π*x*(-x+(π^2)*(2*x-3)+1)-sin(π*x))/(π^3)

xs = [domain.domain.lower:dx/10:domain.domain.upper for domain in domains][1]
u_real  = [analytic_sol_func(x) for x in xs]
u_predict  = [first(phi(x,res.minimizer)) for x in xs]

@test u_predict ≈ u_real atol = 1.0

# x_plot = collect(xs)
# plot(x_plot ,u_real)
# plot!(x_plot ,u_predict)

## Example 4, system of pde
println("Example 4, system of pde")
@parameters x, y
@variables u1(..), u2(..)
Dx = Differential(x)
Dy = Differential(y)

# System of pde
eqs = [Dx(u1(x,y)) + 4*Dy(u2(x,y)) ~ 0,
      Dx(u2(x,y)) + 9*Dy(u1(x,y)) ~ 0,
      3*u1(x,0) ~ 2*u2(x,0)]

# Initial and boundary conditions
bcs = [u1(x,0) ~ 2x, u2(x,0) ~ 3x]

# Space and time domains
domains = [x ∈ IntervalDomain(0.0,1.0), y ∈ IntervalDomain(0.0,1.0)]

# Neural network
chain1 = FastChain(FastDense(2,10,Flux.σ),FastDense(10,1))
chain2 = FastChain(FastDense(2,10,Flux.σ),FastDense(10,1))
strategy = NeuralPDE.QuadratureTraining(quadrature_alg=CubaCuhre(),reltol= 1e-4,abstol= 1e-3,maxiters=20)
discretization = NeuralPDE.PhysicsInformedNN([chain1,chain2],strategy)
pde_system = PDESystem(eqs,bcs,domains,[x,y],[u1,u2])
prob = NeuralPDE.discretize(pde_system,discretization)

res = GalacticOptim.solve(prob,Optim.BFGS(); cb = cb, maxiters=300)
phi = discretization.phi

analytic_sol_func(x,y) =[1/3*(6x - y), 1/2*(6x - y)]
xs,ys = [domain.domain.lower:0.01:domain.domain.upper for domain in domains]
u_real  = [[analytic_sol_func(x,y)[i] for x in xs  for y in ys] for i in 1:2]

initθ = discretization.init_params
acum =  [0;accumulate(+, length.(initθ))]
sep = [acum[i]+1 : acum[i+1] for i in 1:length(acum)-1]
minimizers = [res.minimizer[s] for s in sep]
u_predict  = [[phi[i]([x,y],minimizers[i])[1] for x in xs  for y in ys] for i in 1:2]

@test u_predict ≈ u_real atol = 2.0

# p1 =plot(xs, ys, u_predict, st=:surface);
# p2 = plot(xs, ys, u_real, st=:surface);
# plot(p1,p2)

## Example 5, 2d wave equation, neumann boundary condition
println("Example 5, 2d wave equation, neumann boundary condition")
#here we use low level api for build solution
@parameters x, t
@variables u(..)
Dxx = Differential(x)^2
Dtt = Differential(t)^2
Dt = Differential(t)

#2D PDE
C=1
eq  = Dtt(u(x,t)) ~ C^2*Dxx(u(x,t))

# Initial and boundary conditions
bcs = [u(0,t) ~ 0.,# for all t > 0
       u(1,t) ~ 0.,# for all t > 0
       u(x,0) ~ x*(1. - x), #for all 0 < x < 1
       Dt(u(x,0)) ~ 0. ] #for all  0 < x < 1]

# Space and time domains
domains = [x ∈ IntervalDomain(0.0,1.0),
           t ∈ IntervalDomain(0.0,1.0)]

# Neural network
chain = FastChain(FastDense(2,16,Flux.σ),FastDense(16,16,Flux.σ),FastDense(16,1))

phi = NeuralPDE.get_phi(chain)
derivative = NeuralPDE.get_numeric_derivative()
initθ = DiffEqFlux.initial_params(chain)

indvars = [x,t]
depvars = [u]
dim = length(domains)

_pde_loss_function = NeuralPDE.build_loss_function(eq,indvars,depvars,phi, derivative,initθ)

bc_indvars = NeuralPDE.get_bc_varibles(bcs,indvars,depvars)
_bc_loss_functions = [NeuralPDE.build_loss_function(bc,indvars,depvars, phi, derivative,initθ,
                                              bc_indvars = bc_indvar) for (bc,bc_indvar) in zip(bcs,bc_indvars)]

dx = 0.1
train_sets = NeuralPDE.generate_training_sets(domains,dx,bcs,indvars,depvars)
pde_train_set,bcs_train_set,train_set = train_sets
pde_bounds, bcs_bounds = NeuralPDE.get_bounds(domains,bcs,indvars,depvars)

quadrature_strategy = NeuralPDE.QuadratureTraining(quadrature_alg=HCubatureJL(),reltol= 1e-4,abstol= 1e-3,maxiters=10)
pde_loss_function = NeuralPDE.get_loss_function(_pde_loss_function,
                                                pde_bounds,
                                                quadrature_strategy;
                                                τ = 1/100)

quadrature_strategy = NeuralPDE.QuadratureTraining(quadrature_alg=HCubatureJL(),reltol= 1e-2,abstol= 1e-1,maxiters=5)
bc_loss_function = NeuralPDE.get_loss_function(_bc_loss_functions,
                                               bcs_bounds,
                                               quadrature_strategy;
                                               τ = 1/40)

function loss_function_(θ,p)
    return pde_loss_function(θ) + bc_loss_function(θ)
end

f_ = OptimizationFunction(loss_function_, GalacticOptim.AutoZygote())
prob = GalacticOptim.OptimizationProblem(f_, initθ)

cb_ = function (p,l)
    println("Current losses are: ", pde_loss_function(p), " , ",  bc_loss_function(p))
    return false
end

res = GalacticOptim.solve(prob,Optim.BFGS(); cb = cb_, maxiters=400)

xs,ts = [domain.domain.lower:dx:domain.domain.upper for domain in domains]
analytic_sol_func(x,t) =  sum([(8/(k^3*pi^3)) * sin(k*pi*x)*cos(C*k*pi*t) for k in 1:2:50000])

u_predict = reshape([first(phi([x,t],res.minimizer)) for x in xs for t in ts],(length(xs),length(ts)))
u_real = reshape([analytic_sol_func(x,t) for x in xs for t in ts], (length(xs),length(ts)))

@test u_predict ≈ u_real atol = 1.0

# diff_u = abs.(u_predict .- u_real)
# p1 = plot(xs, ts, u_real, linetype=:contourf,title = "analytic");
# p2 =plot(xs, ts, u_predict, linetype=:contourf,title = "predict");
# p3 = plot(xs, ts, diff_u,linetype=:contourf,title = "error");
# plot(p1,p2,p3)

## Example 6, pde with mixed derivative
println("Example 6, pde with mixed derivative")
@parameters x y
@variables u(..)
Dxx = Differential(x)^2
Dyy = Differential(y)^2
Dx = Differential(x)
Dy = Differential(y)

eq = Dxx(u(x,y)) + Dx(Dy(u(x,y))) - 2*Dyy(u(x,y)) ~  -1.

# Initial and boundary conditions
bcs = [u(x,0) ~ x,
       Dy(u(x,0)) ~ x,
       u(x,0) ~ Dy(u(x,0))]

# Space and time domains
domains = [x ∈ IntervalDomain(0.0,1.0), y ∈ IntervalDomain(0.0,1.0)]

# Discretization
dx = 0.1
quadrature_strategy = NeuralPDE.QuadratureTraining(quadrature_alg=HCubatureJL(),reltol= 1e-2,abstol= 1e-2,maxiters=10)
# Neural network
chain = FastChain(FastDense(2,12,Flux.σ),FastDense(12,12,Flux.σ),FastDense(12,1))
discretization = NeuralPDE.PhysicsInformedNN(chain, quadrature_strategy)
pde_system = PDESystem(eq,bcs,domains,[x,y],[u])
prob = NeuralPDE.discretize(pde_system,discretization)

res = GalacticOptim.solve(prob,Optim.BFGS(); cb = cb, maxiters=200)
phi = discretization.phi

analytic_sol_func(x,y) = x + x*y +y^2/2
xs,ys = [domain.domain.lower:dx:domain.domain.upper for domain in domains]

u_predict = reshape([first(phi([x,y],res.minimizer)) for x in xs for y in ys],(length(xs),length(ys)))
u_real = reshape([analytic_sol_func(x,y) for x in xs for y in ys], (length(xs),length(ys)))
diff_u = abs.(u_predict .- u_real)

@test u_predict ≈ u_real atol = 1.0

# p1 = plot(xs, ys, u_real, linetype=:contourf,title = "analytic");
# p2 = plot(xs, ys, u_predict, linetype=:contourf,title = "predict");
# p3 = plot(xs, ys, diff_u,linetype=:contourf,title = "error");
# plot(p1,p2,p3)

## Example 7, Fokker-Planck equation
println("Example 7, Fokker-Planck equation")
# the example took from this article https://arxiv.org/abs/1910.10503
@parameters x
@variables p(..)
Dx = Differential(x)
Dxx = Differential(x)^2

#2D PDE
α = 0.3
β = 0.5
_σ = 0.5
# Discretization
dx = 0.05
# here we use normalization condition: dx*p(x) ~ 1, in order to get non-zero solution.
#(α - 3*β*x^2)*p(x) + (α*x - β*x^3)*Dx(p(x)) ~ (_σ^2/2)*Dxx(p(x))
eq  = Dx((α*x - β*x^3)*p(x)) ~ (_σ^2/2)*Dxx(p(x))+dx*p(x) - 1.

# Initial and boundary conditions
bcs = [p(-2.2) ~ 0. ,p(2.2) ~ 0. , p(-2.2) ~ p(2.2)]

# Space and time domains
domains = [x ∈ IntervalDomain(-2.2,2.2)]

# Neural network
chain = FastChain(FastDense(1,16,Flux.σ),FastDense(16,16,Flux.σ),FastDense(16,1))

discretization = NeuralPDE.PhysicsInformedNN(chain,
                                             NeuralPDE.GridTraining(dx))

pde_system = PDESystem(eq,bcs,domains,[x],[p])
prob = NeuralPDE.discretize(pde_system,discretization)

res = GalacticOptim.solve(prob,Optim.BFGS(); cb = cb, maxiters=800)

pde_system2 = remake(pde_system; eqs = Dx((α*x - β*x^3)*p(x)) ~ (_σ^2/2)*Dxx(p(x)))
discretization2 = remake(discretization; strategy = NeuralPDE.GridTraining(dx/5), init_params =res.minimizer)
prob2 = NeuralPDE.discretize(pde_system2,discretization2)

res = GalacticOptim.solve(prob2,Optim.BFGS();cb=cb,maxiters=200)
phi = discretization.phi

analytic_sol_func(x) = 28*exp((1/(2*_σ^2))*(2*α*x^2 - β*x^4))

xs = [domain.domain.lower:dx:domain.domain.upper for domain in domains][1]
u_real  = [analytic_sol_func(x) for x in xs]
u_predict  = [first(phi(x,Array(res.minimizer))) for x in xs]

@test u_predict ≈ u_real atol = 6.0

# plot(xs ,u_real, label = "analytic")
# plot!(xs ,u_predict, label = "predict")


text:
#=
Copyright (c) 2018-2022 Chris Coey, Lea Kapelevich, and contributors

This Julia package Hypatia.jl is released under the MIT license; see LICENSE
file in the root directory or at https://github.com/chriscoey/Hypatia.jl
=#
"""
$(TYPEDEF)

An implementation type for the sparse positive semidefinite cone
[`PosSemidefTriSparse`](@ref).
"""
abstract type PSDSparseImpl end

# a cache for an implementation for the sparse positive semidefinite cone
abstract type PSDSparseCache{T <: Real, R <: RealOrComplex{T}} end

"""
$(TYPEDEF)

Real symmetric or complex Hermitian sparse positive semidefinite cone of side
dimension `side` and sparse lower triangle row and column indices `rows`, `cols`
in svec format. Note all diagonal elements must be present.

    $(FUNCTIONNAME){T, R}(side::Int, rows::Vector{Int}, cols::Vector{Int}, use_dual::Bool = false)
"""
mutable struct PosSemidefTriSparse{I <: PSDSparseImpl, T <: Real,
    R <: RealOrComplex{T}} <: Cone{T}
    use_dual_barrier::Bool
    dim::Int
    side::Int
    row_idxs::Vector{Int}
    col_idxs::Vector{Int}
    is_complex::Bool
    rt2::T

    point::Vector{T}
    dual_point::Vector{T}
    grad::Vector{T}
    dder3::Vector{T}
    vec1::Vector{T}
    vec2::Vector{T}
    feas_updated::Bool
    grad_updated::Bool
    hess_updated::Bool
    inv_hess_updated::Bool
    hess_fact_updated::Bool
    is_feas::Bool
    hess::Symmetric{T, Matrix{T}}
    inv_hess::Symmetric{T, Matrix{T}}
    hess_fact_mat::Symmetric{T, Matrix{T}}
    hess_fact::Factorization{T}
    use_hess_prod_slow::Bool
    use_hess_prod_slow_updated::Bool

    cache::PSDSparseCache{T, R}

    function PosSemidefTriSparse{I, T, R}(
        side::Int,
        row_idxs::Vector{Int},
        col_idxs::Vector{Int};
        use_dual::Bool = false,
        ) where {I <: PSDSparseImpl, T <: Real, R <: RealOrComplex{T}}
        # check validity of inputs
        num_nz = length(row_idxs)
        @assert length(col_idxs) == num_nz
        # TODO maybe also check no off-diags appear twice?
        diag_present = falses(side)
        for (row_idx, col_idx) in zip(row_idxs, col_idxs)
            @assert col_idx <= row_idx <= side
            if row_idx == col_idx
                @assert !diag_present[row_idx] # don't count element twice
                diag_present[row_idx] = true
            end
        end
        @assert all(diag_present)
        cone = new{I, T, R}()
        if R <: Real
            cone.dim = num_nz
            cone.is_complex = false
        else
            cone.dim = 2 * num_nz - side
            cone.is_complex = true
        end
        @assert cone.dim >= 1
        cone.use_dual_barrier = use_dual
        cone.side = side # side dimension of sparse matrix
        cone.row_idxs = row_idxs
        cone.col_idxs = col_idxs
        cone.rt2 = sqrt(T(2))
        return cone
    end
end

reset_data(cone::PosSemidefTriSparse) = (cone.feas_updated = cone.grad_updated =
    cone.hess_updated = cone.inv_hess_updated = cone.hess_fact_updated =
    cone.use_hess_prod_slow = cone.use_hess_prod_slow_updated = false)

get_nu(cone::PosSemidefTriSparse) = cone.side

function set_initial_point!(arr::AbstractVector, cone::PosSemidefTriSparse)
    idx = 1
    incr = (cone.is_complex ? 2 : 1)
    fill!(arr, 0)
    @inbounds for (row_idx, col_idx) in zip(cone.row_idxs, cone.col_idxs)
        if row_idx == col_idx
            arr[idx] = 1
            idx += 1
        else
            idx += incr
        end
    end
    return arr
end

include("denseimpl.jl")
# cholmod implementation only works after this commit
# see https://github.com/JuliaLang/julia/pull/40560
if VERSION >= v"1.7.0-DEV.1025"
    include("cholmodimpl.jl")
    const PSDSparseImplList = [
        (PSDSparseDense, Real),
        (PSDSparseCholmod, LinearAlgebra.BlasReal),
        ]
else
    const PSDSparseCholmod = PSDSparseDense
    const PSDSparseImplList = [(PSDSparseDense, Real),]
end


text:
#  Copyright 2017, Iain Dunning, Joey Huchette, Miles Lubin, and contributors
#  This Source Code Form is subject to the terms of the Mozilla Public
#  License, v. 2.0. If a copy of the MPL was not distributed with this
#  file, You can obtain one at https://mozilla.org/MPL/2.0/.
#############################################################################
# JuMP
# An algebraic modeling language for Julia
# See https://github.com/jump-dev/JuMP.jl
#############################################################################
# test/utilities.jl
# Utility functions used across JuMP's tests.
#############################################################################

macro test_expression(expr)
    return esc(
        quote
            @test JuMP.isequal_canonical(@expression(model, $expr), $expr)
        end,
    )
end

macro test_expression_with_string(expr, str)
    return esc(
        quote
            realized_expr = @inferred $expr
            @test string(realized_expr) == $str
            @test JuMP.isequal_canonical(
                @expression(model, $expr),
                realized_expr,
            )
        end,
    )
end

function _strip_line_from_error(err::ErrorException)
    return ErrorException(replace(err.msg, r"^At.+\:[0-9]+\: `@" => "In `@"))
end
_strip_line_from_error(err::LoadError) = _strip_line_from_error(err.error)
_strip_line_from_error(err) = err

# Test that the macro call `m` throws an error exception during pre-compilation
macro test_macro_throws(errortype, m)
    # See https://discourse.julialang.org/t/test-throws-with-macros-after-pr-23533/5878
    quote
        @test_throws(
            $(esc(_strip_line_from_error(errortype))),
            try
                @eval $m
            catch err
                throw(_strip_line_from_error(err))
            end
        )
    end
end

# Test that the macro call `m` throws an error exception during _runtime_.
macro test_throws_strip(errortype, m)
    quote
        @test_throws(
            $(esc(_strip_line_from_error(errortype))),
            try
                $(esc(m))
            catch err
                throw(_strip_line_from_error(err))
            end
        )
    end
end

max_stars_repo_name: ethansaxenian/RosettaDecode

max_issues_repo_name: ethansaxenian/RosettaDecode

max_forks_repo_name: ethansaxenian/RosettaDecode


text:
using Electron
using URIParser
using Test

@testset "Electron" begin

@testset "local URI" begin
    dir = pwd(URI)
    @test unescape(dir.path) == join(push!(split(pwd(), Base.Filesystem.path_separator_re), ""), "/")
    @test dir.query == dir.fragment == dir.host == ""
    @test string(dir) == "file://$(dir.path)"

    __dirname = @__DIR__
    dir = Electron.URI_file(__dirname, "")
    @test_skip URI(dir, path = dir.path * "test.html", query = "a", fragment = "b") ==
        Electron.@LOCAL("test.html?a#b") ==
        Electron.@LOCAL(begin; "test.html?a#b"; end) ==
        Electron.URI_file(__dirname, "test.html?a#b")
end

@testset "Core" begin

w = Window(URI("file://test.html"))

a = applications()[1]

@test isa(w, Window)

@test length(applications()) == 1
@test length(windows(a)) == 1

res = run(w, "Math.log(Math.exp(1))")

@test res == 1

res = run(a, "Math.log(Math.exp(1))")

@test res ==1

close(w)
@test length(applications()) == 1
@test isempty(windows(a)) == 1

w2 = Window(URI("file://test.html"))

toggle_devtools(w2)

close(a)
@test length(applications()) == 1
@test length(windows(a)) == 0

sleep(1)
@test isempty(applications())
@test isempty(windows(a))

w3 = Window(Dict("url" => string(URI("file://test.html"))))

w4 = Window(URI("file://test.html"), options=Dict("title" => "Window title"))

w5 = Window("", options=Dict("title" => "Window title"))

a2 = applications()[1]

w6 = Window(a2, "", options=Dict("title" => "Window title"))

w7 = Window(a2)

run(w7, "sendMessageToJulia('foo')")

@test take!(msgchannel(w7)) == "foo"

load(w7, "bar")

run(w7, "sendMessageToJulia(window.document.documentElement.innerHTML)")

@test occursin("bar", take!(msgchannel(w7)))

@testset "ElectronAPI" begin
    win = Window()

    @test (ElectronAPI.setBackgroundColor(win, "#000"); true)
    @test ElectronAPI.isFocused(win) isa Bool

    bounds = ElectronAPI.getBounds(win)
    boundskeys = ["width", "height", "x", "y"]
    @test Set(boundskeys) <= Set(keys(bounds))
    @test all(isa.(get.(Ref(bounds), boundskeys, nothing), Real))

    close(win)
end

close(w7)

close(w3)
close(w4)
close(w5)
close(w6)
close(a2)

end # testset "Electron"

end


text:
using StatsBase, Distributions, Plots; pyplot()

function prn(lambda)
    k, p = 0, 1
    while p > MathConstants.e^(-lambda)
        k += 1
        p *= rand()
    end
    return k-1
end

xGrid, lambda, N = 0:16, 5.5, 10^6

pDist = Poisson(lambda)
bPmf = pdf.(pDist,xGrid)
data = counts([prn(lambda) for _ in 1:N],xGrid)/N

plot( xGrid, data,
	line=:stem, marker=:circle,
	c=:blue, ms=10, msw=0, lw=4, label="MC estimate")
plot!( xGrid, bPmf, line=:stem,
	marker=:xcross, c=:red, ms=6, msw=0, lw=2, label="PMF",
	ylims=(0,0.2), xlabel="x", ylabel="Probability of x events")

max_stars_repo_name: Yoshinobu-Ishizaki/StatsWithJuliaBook

max_issues_repo_name: Yoshinobu-Ishizaki/StatsWithJuliaBook

max_forks_repo_name: Yoshinobu-Ishizaki/StatsWithJuliaBook