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

"""
    associate_delegate_to_resource(entity_id, organization_id, resource_id)
    associate_delegate_to_resource(entity_id, organization_id, resource_id, params::Dict{String,<:Any})

Adds a member (user or group) to the resource's set of delegates.

# Arguments
- `entity_id`: The member (user or group) to associate to the resource.
- `organization_id`: The organization under which the resource exists.
- `resource_id`: The resource for which members (users or groups) are associated.

"""
associate_delegate_to_resource(EntityId, OrganizationId, ResourceId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("AssociateDelegateToResource", Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId); aws_config=aws_config)
associate_delegate_to_resource(EntityId, OrganizationId, ResourceId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("AssociateDelegateToResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId), params)); aws_config=aws_config)

"""
    associate_member_to_group(group_id, member_id, organization_id)
    associate_member_to_group(group_id, member_id, organization_id, params::Dict{String,<:Any})

Adds a member (user or group) to the group's set.

# Arguments
- `group_id`: The group to which the member (user or group) is associated.
- `member_id`: The member (user or group) to associate to the group.
- `organization_id`: The organization under which the group exists.

"""
associate_member_to_group(GroupId, MemberId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("AssociateMemberToGroup", Dict{String, Any}("GroupId"=>GroupId, "MemberId"=>MemberId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
associate_member_to_group(GroupId, MemberId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("AssociateMemberToGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("GroupId"=>GroupId, "MemberId"=>MemberId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    cancel_mailbox_export_job(client_token, job_id, organization_id)
    cancel_mailbox_export_job(client_token, job_id, organization_id, params::Dict{String,<:Any})

Cancels a mailbox export job.  If the mailbox export job is near completion, it might not
be possible to cancel it.

# Arguments
- `client_token`: The idempotency token for the client request.
- `job_id`: The job ID.
- `organization_id`: The organization ID.

"""
cancel_mailbox_export_job(ClientToken, JobId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CancelMailboxExportJob", Dict{String, Any}("ClientToken"=>ClientToken, "JobId"=>JobId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
cancel_mailbox_export_job(ClientToken, JobId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CancelMailboxExportJob", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClientToken"=>ClientToken, "JobId"=>JobId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    create_alias(alias, entity_id, organization_id)
    create_alias(alias, entity_id, organization_id, params::Dict{String,<:Any})

Adds an alias to the set of a given member (user or group) of Amazon WorkMail.

# Arguments
- `alias`: The alias to add to the member set.
- `entity_id`: The member (user or group) to which this alias is added.
- `organization_id`: The organization under which the member (user or group) exists.

"""
create_alias(Alias, EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateAlias", Dict{String, Any}("Alias"=>Alias, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
create_alias(Alias, EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateAlias", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Alias"=>Alias, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Creates a group that can be used in Amazon WorkMail by calling the RegisterToWorkMail
operation.

# Arguments
- `name`: The name of the group.
- `organization_id`: The organization under which the group is to be created.

"""
create_group(Name, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateGroup", Dict{String, Any}("Name"=>Name, "OrganizationId"=>OrganizationId); aws_config=aws_config)
create_group(Name, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Name"=>Name, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Creates a new Amazon WorkMail organization. Optionally, you can choose to associate an
existing AWS Directory Service directory with your organization. If an AWS Directory
Service directory ID is specified, the organization alias must match the directory alias.
If you choose not to associate an existing directory with your organization, then we create
a new Amazon WorkMail directory for you. For more information, see Adding an organization
in the Amazon WorkMail Administrator Guide. You can associate multiple email domains with
an organization, then set your default email domain from the Amazon WorkMail console. You
can also associate a domain that is managed in an Amazon Route 53 public hosted zone. For
more information, see Adding a domain and Choosing the default domain in the Amazon
WorkMail Administrator Guide. Optionally, you can use a customer managed master key from
AWS Key Management Service (AWS KMS) to encrypt email for your organization. If you don't
associate an AWS KMS key, Amazon WorkMail creates a default AWS managed master key for you.

# Arguments
- `alias`: The organization alias.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientToken"`: The idempotency token associated with the request.
- `"DirectoryId"`: The AWS Directory Service directory ID.
- `"Domains"`: The email domains to associate with the organization.
- `"EnableInteroperability"`: When true, allows organization interoperability between
  Amazon WorkMail and Microsoft Exchange. Can only be set to true if an AD Connector
  directory ID is included in the request.
- `"KmsKeyArn"`: The Amazon Resource Name (ARN) of a customer managed master key from AWS
  KMS.
"""
create_organization(Alias; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateOrganization", Dict{String, Any}("Alias"=>Alias, "ClientToken"=>string(uuid4())); aws_config=aws_config)
create_organization(Alias, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateOrganization", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Alias"=>Alias, "ClientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    create_resource(name, organization_id, type)
    create_resource(name, organization_id, type, params::Dict{String,<:Any})

Creates a new Amazon WorkMail resource.

# Arguments
- `name`: The name of the new resource.
- `organization_id`: The identifier associated with the organization for which the resource
  is created.
- `type`: The type of the new resource. The available types are equipment and room.

"""
create_resource(Name, OrganizationId, Type; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateResource", Dict{String, Any}("Name"=>Name, "OrganizationId"=>OrganizationId, "Type"=>Type); aws_config=aws_config)
create_resource(Name, OrganizationId, Type, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Name"=>Name, "OrganizationId"=>OrganizationId, "Type"=>Type), params)); aws_config=aws_config)

"""
    create_user(display_name, name, organization_id, password)
    create_user(display_name, name, organization_id, password, params::Dict{String,<:Any})

Creates a user who can be used in Amazon WorkMail by calling the RegisterToWorkMail
operation.

# Arguments
- `display_name`: The display name for the new user.
- `name`: The name for the new user. WorkMail directory user names have a maximum length of
  64. All others have a maximum length of 20.
- `organization_id`: The identifier of the organization for which the user is created.
- `password`: The password for the new user.

"""
create_user(DisplayName, Name, OrganizationId, Password; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateUser", Dict{String, Any}("DisplayName"=>DisplayName, "Name"=>Name, "OrganizationId"=>OrganizationId, "Password"=>Password); aws_config=aws_config)
create_user(DisplayName, Name, OrganizationId, Password, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("CreateUser", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DisplayName"=>DisplayName, "Name"=>Name, "OrganizationId"=>OrganizationId, "Password"=>Password), params)); aws_config=aws_config)

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

Deletes an access control rule for the specified WorkMail organization.

# Arguments
- `name`: The name of the access control rule.
- `organization_id`: The identifier for the organization.

"""
delete_access_control_rule(Name, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteAccessControlRule", Dict{String, Any}("Name"=>Name, "OrganizationId"=>OrganizationId); aws_config=aws_config)
delete_access_control_rule(Name, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteAccessControlRule", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Name"=>Name, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    delete_alias(alias, entity_id, organization_id)
    delete_alias(alias, entity_id, organization_id, params::Dict{String,<:Any})

Remove one or more specified aliases from a set of aliases for a given user.

# Arguments
- `alias`: The aliases to be removed from the user's set of aliases. Duplicate entries in
  the list are collapsed into single entries (the list is transformed into a set).
- `entity_id`: The identifier for the member (user or group) from which to have the aliases
  removed.
- `organization_id`: The identifier for the organization under which the user exists.

"""
delete_alias(Alias, EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteAlias", Dict{String, Any}("Alias"=>Alias, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
delete_alias(Alias, EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteAlias", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Alias"=>Alias, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    delete_group(group_id, organization_id)
    delete_group(group_id, organization_id, params::Dict{String,<:Any})

Deletes a group from Amazon WorkMail.

# Arguments
- `group_id`: The identifier of the group to be deleted.
- `organization_id`: The organization that contains the group.

"""
delete_group(GroupId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteGroup", Dict{String, Any}("GroupId"=>GroupId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
delete_group(GroupId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("GroupId"=>GroupId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    delete_mailbox_permissions(entity_id, grantee_id, organization_id)
    delete_mailbox_permissions(entity_id, grantee_id, organization_id, params::Dict{String,<:Any})

Deletes permissions granted to a member (user or group).

# Arguments
- `entity_id`: The identifier of the member (user or group) that owns the mailbox.
- `grantee_id`: The identifier of the member (user or group) for which to delete granted
  permissions.
- `organization_id`: The identifier of the organization under which the member (user or
  group) exists.

"""
delete_mailbox_permissions(EntityId, GranteeId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteMailboxPermissions", Dict{String, Any}("EntityId"=>EntityId, "GranteeId"=>GranteeId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
delete_mailbox_permissions(EntityId, GranteeId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteMailboxPermissions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "GranteeId"=>GranteeId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    delete_organization(delete_directory, organization_id)
    delete_organization(delete_directory, organization_id, params::Dict{String,<:Any})

Deletes an Amazon WorkMail organization and all underlying AWS resources managed by Amazon
WorkMail as part of the organization. You can choose whether to delete the associated
directory. For more information, see Removing an organization in the Amazon WorkMail
Administrator Guide.

# Arguments
- `delete_directory`: If true, deletes the AWS Directory Service directory associated with
  the organization.
- `organization_id`: The organization ID.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClientToken"`: The idempotency token associated with the request.
"""
delete_organization(DeleteDirectory, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteOrganization", Dict{String, Any}("DeleteDirectory"=>DeleteDirectory, "OrganizationId"=>OrganizationId, "ClientToken"=>string(uuid4())); aws_config=aws_config)
delete_organization(DeleteDirectory, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteOrganization", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DeleteDirectory"=>DeleteDirectory, "OrganizationId"=>OrganizationId, "ClientToken"=>string(uuid4())), params)); aws_config=aws_config)

"""
    delete_resource(organization_id, resource_id)
    delete_resource(organization_id, resource_id, params::Dict{String,<:Any})

Deletes the specified resource.

# Arguments
- `organization_id`: The identifier associated with the organization from which the
  resource is deleted.
- `resource_id`: The identifier of the resource to be deleted.

"""
delete_resource(OrganizationId, ResourceId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteResource", Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId); aws_config=aws_config)
delete_resource(OrganizationId, ResourceId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId), params)); aws_config=aws_config)

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

Deletes the specified retention policy from the specified organization.

# Arguments
- `id`: The retention policy ID.
- `organization_id`: The organization ID.

"""
delete_retention_policy(Id, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteRetentionPolicy", Dict{String, Any}("Id"=>Id, "OrganizationId"=>OrganizationId); aws_config=aws_config)
delete_retention_policy(Id, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteRetentionPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Id"=>Id, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    delete_user(organization_id, user_id)
    delete_user(organization_id, user_id, params::Dict{String,<:Any})

Deletes a user from Amazon WorkMail and all subsequent systems. Before you can delete a
user, the user state must be DISABLED. Use the DescribeUser action to confirm the user
state. Deleting a user is permanent and cannot be undone. WorkMail archives user mailboxes
for 30 days before they are permanently removed.

# Arguments
- `organization_id`: The organization that contains the user to be deleted.
- `user_id`: The identifier of the user to be deleted.

"""
delete_user(OrganizationId, UserId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteUser", Dict{String, Any}("OrganizationId"=>OrganizationId, "UserId"=>UserId); aws_config=aws_config)
delete_user(OrganizationId, UserId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeleteUser", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "UserId"=>UserId), params)); aws_config=aws_config)

"""
    deregister_from_work_mail(entity_id, organization_id)
    deregister_from_work_mail(entity_id, organization_id, params::Dict{String,<:Any})

Mark a user, group, or resource as no longer used in Amazon WorkMail. This action
disassociates the mailbox and schedules it for clean-up. WorkMail keeps mailboxes for 30
days before they are permanently removed. The functionality in the console is Disable.

# Arguments
- `entity_id`: The identifier for the member (user or group) to be updated.
- `organization_id`: The identifier for the organization under which the Amazon WorkMail
  entity exists.

"""
deregister_from_work_mail(EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeregisterFromWorkMail", Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
deregister_from_work_mail(EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DeregisterFromWorkMail", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    describe_group(group_id, organization_id)
    describe_group(group_id, organization_id, params::Dict{String,<:Any})

Returns the data available for the group.

# Arguments
- `group_id`: The identifier for the group to be described.
- `organization_id`: The identifier for the organization under which the group exists.

"""
describe_group(GroupId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeGroup", Dict{String, Any}("GroupId"=>GroupId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
describe_group(GroupId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("GroupId"=>GroupId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Describes the current status of a mailbox export job.

# Arguments
- `job_id`: The mailbox export job ID.
- `organization_id`: The organization ID.

"""
describe_mailbox_export_job(JobId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeMailboxExportJob", Dict{String, Any}("JobId"=>JobId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
describe_mailbox_export_job(JobId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeMailboxExportJob", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("JobId"=>JobId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Provides more information regarding a given organization based on its identifier.

# Arguments
- `organization_id`: The identifier for the organization to be described.

"""
describe_organization(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeOrganization", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
describe_organization(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeOrganization", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    describe_resource(organization_id, resource_id)
    describe_resource(organization_id, resource_id, params::Dict{String,<:Any})

Returns the data available for the resource.

# Arguments
- `organization_id`: The identifier associated with the organization for which the resource
  is described.
- `resource_id`: The identifier of the resource to be described.

"""
describe_resource(OrganizationId, ResourceId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeResource", Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId); aws_config=aws_config)
describe_resource(OrganizationId, ResourceId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId), params)); aws_config=aws_config)

"""
    describe_user(organization_id, user_id)
    describe_user(organization_id, user_id, params::Dict{String,<:Any})

Provides information regarding the user.

# Arguments
- `organization_id`: The identifier for the organization under which the user exists.
- `user_id`: The identifier for the user to be described.

"""
describe_user(OrganizationId, UserId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeUser", Dict{String, Any}("OrganizationId"=>OrganizationId, "UserId"=>UserId); aws_config=aws_config)
describe_user(OrganizationId, UserId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DescribeUser", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "UserId"=>UserId), params)); aws_config=aws_config)

"""
    disassociate_delegate_from_resource(entity_id, organization_id, resource_id)
    disassociate_delegate_from_resource(entity_id, organization_id, resource_id, params::Dict{String,<:Any})

Removes a member from the resource's set of delegates.

# Arguments
- `entity_id`: The identifier for the member (user, group) to be removed from the
  resource's delegates.
- `organization_id`: The identifier for the organization under which the resource exists.
- `resource_id`: The identifier of the resource from which delegates' set members are
  removed.

"""
disassociate_delegate_from_resource(EntityId, OrganizationId, ResourceId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DisassociateDelegateFromResource", Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId); aws_config=aws_config)
disassociate_delegate_from_resource(EntityId, OrganizationId, ResourceId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DisassociateDelegateFromResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId), params)); aws_config=aws_config)

"""
    disassociate_member_from_group(group_id, member_id, organization_id)
    disassociate_member_from_group(group_id, member_id, organization_id, params::Dict{String,<:Any})

Removes a member from a group.

# Arguments
- `group_id`: The identifier for the group from which members are removed.
- `member_id`: The identifier for the member to be removed to the group.
- `organization_id`: The identifier for the organization under which the group exists.

"""
disassociate_member_from_group(GroupId, MemberId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DisassociateMemberFromGroup", Dict{String, Any}("GroupId"=>GroupId, "MemberId"=>MemberId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
disassociate_member_from_group(GroupId, MemberId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("DisassociateMemberFromGroup", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("GroupId"=>GroupId, "MemberId"=>MemberId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    get_access_control_effect(action, ip_address, organization_id, user_id)
    get_access_control_effect(action, ip_address, organization_id, user_id, params::Dict{String,<:Any})

Gets the effects of an organization's access control rules as they apply to a specified
IPv4 address, access protocol action, or user ID.

# Arguments
- `action`: The access protocol action. Valid values include ActiveSync, AutoDiscover, EWS,
  IMAP, SMTP, WindowsOutlook, and WebMail.
- `ip_address`: The IPv4 address.
- `organization_id`: The identifier for the organization.
- `user_id`: The user ID.

"""
get_access_control_effect(Action, IpAddress, OrganizationId, UserId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("GetAccessControlEffect", Dict{String, Any}("Action"=>Action, "IpAddress"=>IpAddress, "OrganizationId"=>OrganizationId, "UserId"=>UserId); aws_config=aws_config)
get_access_control_effect(Action, IpAddress, OrganizationId, UserId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("GetAccessControlEffect", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Action"=>Action, "IpAddress"=>IpAddress, "OrganizationId"=>OrganizationId, "UserId"=>UserId), params)); aws_config=aws_config)

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

Gets the default retention policy details for the specified organization.

# Arguments
- `organization_id`: The organization ID.

"""
get_default_retention_policy(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("GetDefaultRetentionPolicy", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
get_default_retention_policy(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("GetDefaultRetentionPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    get_mailbox_details(organization_id, user_id)
    get_mailbox_details(organization_id, user_id, params::Dict{String,<:Any})

Requests a user's mailbox details for a specified organization and user.

# Arguments
- `organization_id`: The identifier for the organization that contains the user whose
  mailbox details are being requested.
- `user_id`: The identifier for the user whose mailbox details are being requested.

"""
get_mailbox_details(OrganizationId, UserId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("GetMailboxDetails", Dict{String, Any}("OrganizationId"=>OrganizationId, "UserId"=>UserId); aws_config=aws_config)
get_mailbox_details(OrganizationId, UserId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("GetMailboxDetails", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "UserId"=>UserId), params)); aws_config=aws_config)

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

Lists the access control rules for the specified organization.

# Arguments
- `organization_id`: The identifier for the organization.

"""
list_access_control_rules(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListAccessControlRules", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
list_access_control_rules(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListAccessControlRules", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    list_aliases(entity_id, organization_id)
    list_aliases(entity_id, organization_id, params::Dict{String,<:Any})

Creates a paginated call to list the aliases associated with a given entity.

# Arguments
- `entity_id`: The identifier for the entity for which to list the aliases.
- `organization_id`: The identifier for the organization under which the entity exists.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results. The first call does
  not contain any tokens.
"""
list_aliases(EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListAliases", Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
list_aliases(EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListAliases", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    list_group_members(group_id, organization_id)
    list_group_members(group_id, organization_id, params::Dict{String,<:Any})

Returns an overview of the members of a group. Users and groups can be members of a group.

# Arguments
- `group_id`: The identifier for the group to which the members (users or groups) are
  associated.
- `organization_id`: The identifier for the organization under which the group exists.

# 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 a single call.
- `"NextToken"`:  The token to use to retrieve the next page of results. The first call
  does not contain any tokens.
"""
list_group_members(GroupId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListGroupMembers", Dict{String, Any}("GroupId"=>GroupId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
list_group_members(GroupId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListGroupMembers", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("GroupId"=>GroupId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Returns summaries of the organization's groups.

# Arguments
- `organization_id`: The identifier for the organization under which the groups exist.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results. The first call does
  not contain any tokens.
"""
list_groups(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListGroups", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
list_groups(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListGroups", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Lists the mailbox export jobs started for the specified organization within the last seven
days.

# Arguments
- `organization_id`: The organization ID.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results.
"""
list_mailbox_export_jobs(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListMailboxExportJobs", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
list_mailbox_export_jobs(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListMailboxExportJobs", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    list_mailbox_permissions(entity_id, organization_id)
    list_mailbox_permissions(entity_id, organization_id, params::Dict{String,<:Any})

Lists the mailbox permissions associated with a user, group, or resource mailbox.

# Arguments
- `entity_id`: The identifier of the user, group, or resource for which to list mailbox
  permissions.
- `organization_id`: The identifier of the organization under which the user, group, or
  resource exists.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results. The first call does
  not contain any tokens.
"""
list_mailbox_permissions(EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListMailboxPermissions", Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
list_mailbox_permissions(EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListMailboxPermissions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Returns summaries of the customer's organizations.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results. The first call does
  not contain any tokens.
"""
list_organizations(; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListOrganizations"; aws_config=aws_config)
list_organizations(params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListOrganizations", params; aws_config=aws_config)

"""
    list_resource_delegates(organization_id, resource_id)
    list_resource_delegates(organization_id, resource_id, params::Dict{String,<:Any})

Lists the delegates associated with a resource. Users and groups can be resource delegates
and answer requests on behalf of the resource.

# Arguments
- `organization_id`: The identifier for the organization that contains the resource for
  which delegates are listed.
- `resource_id`: The identifier for the resource whose delegates are listed.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: The number of maximum results in a page.
- `"NextToken"`: The token used to paginate through the delegates associated with a
  resource.
"""
list_resource_delegates(OrganizationId, ResourceId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListResourceDelegates", Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId); aws_config=aws_config)
list_resource_delegates(OrganizationId, ResourceId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListResourceDelegates", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId), params)); aws_config=aws_config)

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

Returns summaries of the organization's resources.

# Arguments
- `organization_id`: The identifier for the organization under which the resources exist.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results. The first call does
  not contain any tokens.
"""
list_resources(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListResources", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
list_resources(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListResources", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

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

Lists the tags applied to an Amazon WorkMail organization resource.

# Arguments
- `resource_arn`: The resource ARN.

"""
list_tags_for_resource(ResourceARN; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListTagsForResource", Dict{String, Any}("ResourceARN"=>ResourceARN); aws_config=aws_config)
list_tags_for_resource(ResourceARN, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListTagsForResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceARN"=>ResourceARN), params)); aws_config=aws_config)

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

Returns summaries of the organization's users.

# Arguments
- `organization_id`: The identifier for the organization under which the users exist.

# 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 a single call.
- `"NextToken"`: The token to use to retrieve the next page of results. The first call does
  not contain any tokens.
"""
list_users(OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListUsers", Dict{String, Any}("OrganizationId"=>OrganizationId); aws_config=aws_config)
list_users(OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ListUsers", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    put_access_control_rule(description, effect, name, organization_id)
    put_access_control_rule(description, effect, name, organization_id, params::Dict{String,<:Any})

Adds a new access control rule for the specified organization. The rule allows or denies
access to the organization for the specified IPv4 addresses, access protocol actions, and
user IDs. Adding a new rule with the same name as an existing rule replaces the older rule.

# Arguments
- `description`: The rule description.
- `effect`: The rule effect.
- `name`: The rule name.
- `organization_id`: The identifier of the organization.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Actions"`: Access protocol actions to include in the rule. Valid values include
  ActiveSync, AutoDiscover, EWS, IMAP, SMTP, WindowsOutlook, and WebMail.
- `"IpRanges"`: IPv4 CIDR ranges to include in the rule.
- `"NotActions"`: Access protocol actions to exclude from the rule. Valid values include
  ActiveSync, AutoDiscover, EWS, IMAP, SMTP, WindowsOutlook, and WebMail.
- `"NotIpRanges"`: IPv4 CIDR ranges to exclude from the rule.
- `"NotUserIds"`: User IDs to exclude from the rule.
- `"UserIds"`: User IDs to include in the rule.
"""
put_access_control_rule(Description, Effect, Name, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("PutAccessControlRule", Dict{String, Any}("Description"=>Description, "Effect"=>Effect, "Name"=>Name, "OrganizationId"=>OrganizationId); aws_config=aws_config)
put_access_control_rule(Description, Effect, Name, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("PutAccessControlRule", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Description"=>Description, "Effect"=>Effect, "Name"=>Name, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    put_mailbox_permissions(entity_id, grantee_id, organization_id, permission_values)
    put_mailbox_permissions(entity_id, grantee_id, organization_id, permission_values, params::Dict{String,<:Any})

Sets permissions for a user, group, or resource. This replaces any pre-existing permissions.

# Arguments
- `entity_id`: The identifier of the user, group, or resource for which to update mailbox
  permissions.
- `grantee_id`: The identifier of the user, group, or resource to which to grant the
  permissions.
- `organization_id`: The identifier of the organization under which the user, group, or
  resource exists.
- `permission_values`: The permissions granted to the grantee. SEND_AS allows the grantee
  to send email as the owner of the mailbox (the grantee is not mentioned on these emails).
  SEND_ON_BEHALF allows the grantee to send email on behalf of the owner of the mailbox (the
  grantee is not mentioned as the physical sender of these emails). FULL_ACCESS allows the
  grantee full access to the mailbox, irrespective of other folder-level permissions set on
  the mailbox.

"""
put_mailbox_permissions(EntityId, GranteeId, OrganizationId, PermissionValues; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("PutMailboxPermissions", Dict{String, Any}("EntityId"=>EntityId, "GranteeId"=>GranteeId, "OrganizationId"=>OrganizationId, "PermissionValues"=>PermissionValues); aws_config=aws_config)
put_mailbox_permissions(EntityId, GranteeId, OrganizationId, PermissionValues, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("PutMailboxPermissions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EntityId"=>EntityId, "GranteeId"=>GranteeId, "OrganizationId"=>OrganizationId, "PermissionValues"=>PermissionValues), params)); aws_config=aws_config)

"""
    put_retention_policy(folder_configurations, name, organization_id)
    put_retention_policy(folder_configurations, name, organization_id, params::Dict{String,<:Any})

Puts a retention policy to the specified organization.

# Arguments
- `folder_configurations`: The retention policy folder configurations.
- `name`: The retention policy name.
- `organization_id`: The organization ID.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: The retention policy description.
- `"Id"`: The retention policy ID.
"""
put_retention_policy(FolderConfigurations, Name, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("PutRetentionPolicy", Dict{String, Any}("FolderConfigurations"=>FolderConfigurations, "Name"=>Name, "OrganizationId"=>OrganizationId); aws_config=aws_config)
put_retention_policy(FolderConfigurations, Name, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("PutRetentionPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FolderConfigurations"=>FolderConfigurations, "Name"=>Name, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    register_to_work_mail(email, entity_id, organization_id)
    register_to_work_mail(email, entity_id, organization_id, params::Dict{String,<:Any})

Registers an existing and disabled user, group, or resource for Amazon WorkMail use by
associating a mailbox and calendaring capabilities. It performs no change if the user,
group, or resource is enabled and fails if the user, group, or resource is deleted. This
operation results in the accumulation of costs. For more information, see Pricing. The
equivalent console functionality for this operation is Enable.  Users can either be created
by calling the CreateUser API operation or they can be synchronized from your directory.
For more information, see DeregisterFromWorkMail.

# Arguments
- `email`: The email for the user, group, or resource to be updated.
- `entity_id`: The identifier for the user, group, or resource to be updated.
- `organization_id`: The identifier for the organization under which the user, group, or
  resource exists.

"""
register_to_work_mail(Email, EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("RegisterToWorkMail", Dict{String, Any}("Email"=>Email, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
register_to_work_mail(Email, EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("RegisterToWorkMail", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Email"=>Email, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    reset_password(organization_id, password, user_id)
    reset_password(organization_id, password, user_id, params::Dict{String,<:Any})

Allows the administrator to reset the password for a user.

# Arguments
- `organization_id`: The identifier of the organization that contains the user for which
  the password is reset.
- `password`: The new password for the user.
- `user_id`: The identifier of the user for whom the password is reset.

"""
reset_password(OrganizationId, Password, UserId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ResetPassword", Dict{String, Any}("OrganizationId"=>OrganizationId, "Password"=>Password, "UserId"=>UserId); aws_config=aws_config)
reset_password(OrganizationId, Password, UserId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("ResetPassword", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "Password"=>Password, "UserId"=>UserId), params)); aws_config=aws_config)

"""
    start_mailbox_export_job(client_token, entity_id, kms_key_arn, organization_id, role_arn, s3_bucket_name, s3_prefix)
    start_mailbox_export_job(client_token, entity_id, kms_key_arn, organization_id, role_arn, s3_bucket_name, s3_prefix, params::Dict{String,<:Any})

Starts a mailbox export job to export MIME-format email messages and calendar items from
the specified mailbox to the specified Amazon Simple Storage Service (Amazon S3) bucket.
For more information, see Exporting mailbox content in the Amazon WorkMail Administrator
Guide.

# Arguments
- `client_token`: The idempotency token for the client request.
- `entity_id`: The identifier of the user or resource associated with the mailbox.
- `kms_key_arn`: The Amazon Resource Name (ARN) of the symmetric AWS Key Management Service
  (AWS KMS) key that encrypts the exported mailbox content.
- `organization_id`: The identifier associated with the organization.
- `role_arn`: The ARN of the AWS Identity and Access Management (IAM) role that grants
  write permission to the S3 bucket.
- `s3_bucket_name`: The name of the S3 bucket.
- `s3_prefix`: The S3 bucket prefix.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: The mailbox export job description.
"""
start_mailbox_export_job(ClientToken, EntityId, KmsKeyArn, OrganizationId, RoleArn, S3BucketName, S3Prefix; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("StartMailboxExportJob", Dict{String, Any}("ClientToken"=>ClientToken, "EntityId"=>EntityId, "KmsKeyArn"=>KmsKeyArn, "OrganizationId"=>OrganizationId, "RoleArn"=>RoleArn, "S3BucketName"=>S3BucketName, "S3Prefix"=>S3Prefix); aws_config=aws_config)
start_mailbox_export_job(ClientToken, EntityId, KmsKeyArn, OrganizationId, RoleArn, S3BucketName, S3Prefix, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("StartMailboxExportJob", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClientToken"=>ClientToken, "EntityId"=>EntityId, "KmsKeyArn"=>KmsKeyArn, "OrganizationId"=>OrganizationId, "RoleArn"=>RoleArn, "S3BucketName"=>S3BucketName, "S3Prefix"=>S3Prefix), params)); aws_config=aws_config)

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

Applies the specified tags to the specified Amazon WorkMail organization resource.

# Arguments
- `resource_arn`: The resource ARN.
- `tags`: The tag key-value pairs.

"""
tag_resource(ResourceARN, Tags; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("TagResource", Dict{String, Any}("ResourceARN"=>ResourceARN, "Tags"=>Tags); aws_config=aws_config)
tag_resource(ResourceARN, Tags, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("TagResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceARN"=>ResourceARN, "Tags"=>Tags), params)); aws_config=aws_config)

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

Untags the specified tags from the specified Amazon WorkMail organization resource.

# Arguments
- `resource_arn`: The resource ARN.
- `tag_keys`: The tag keys.

"""
untag_resource(ResourceARN, TagKeys; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UntagResource", Dict{String, Any}("ResourceARN"=>ResourceARN, "TagKeys"=>TagKeys); aws_config=aws_config)
untag_resource(ResourceARN, TagKeys, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UntagResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceARN"=>ResourceARN, "TagKeys"=>TagKeys), params)); aws_config=aws_config)

"""
    update_mailbox_quota(mailbox_quota, organization_id, user_id)
    update_mailbox_quota(mailbox_quota, organization_id, user_id, params::Dict{String,<:Any})

Updates a user's current mailbox quota for a specified organization and user.

# Arguments
- `mailbox_quota`: The updated mailbox quota, in MB, for the specified user.
- `organization_id`: The identifier for the organization that contains the user for whom to
  update the mailbox quota.
- `user_id`: The identifer for the user for whom to update the mailbox quota.

"""
update_mailbox_quota(MailboxQuota, OrganizationId, UserId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UpdateMailboxQuota", Dict{String, Any}("MailboxQuota"=>MailboxQuota, "OrganizationId"=>OrganizationId, "UserId"=>UserId); aws_config=aws_config)
update_mailbox_quota(MailboxQuota, OrganizationId, UserId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UpdateMailboxQuota", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("MailboxQuota"=>MailboxQuota, "OrganizationId"=>OrganizationId, "UserId"=>UserId), params)); aws_config=aws_config)

"""
    update_primary_email_address(email, entity_id, organization_id)
    update_primary_email_address(email, entity_id, organization_id, params::Dict{String,<:Any})

Updates the primary email for a user, group, or resource. The current email is moved into
the list of aliases (or swapped between an existing alias and the current primary email),
and the email provided in the input is promoted as the primary.

# Arguments
- `email`: The value of the email to be updated as primary.
- `entity_id`: The user, group, or resource to update.
- `organization_id`: The organization that contains the user, group, or resource to update.

"""
update_primary_email_address(Email, EntityId, OrganizationId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UpdatePrimaryEmailAddress", Dict{String, Any}("Email"=>Email, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId); aws_config=aws_config)
update_primary_email_address(Email, EntityId, OrganizationId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UpdatePrimaryEmailAddress", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Email"=>Email, "EntityId"=>EntityId, "OrganizationId"=>OrganizationId), params)); aws_config=aws_config)

"""
    update_resource(organization_id, resource_id)
    update_resource(organization_id, resource_id, params::Dict{String,<:Any})

Updates data for the resource. To have the latest information, it must be preceded by a
DescribeResource call. The dataset in the request should be the one expected when
performing another DescribeResource call.

# Arguments
- `organization_id`: The identifier associated with the organization for which the resource
  is updated.
- `resource_id`: The identifier of the resource to be updated.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"BookingOptions"`: The resource's booking options to be updated.
- `"Name"`: The name of the resource to be updated.
"""
update_resource(OrganizationId, ResourceId; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UpdateResource", Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId); aws_config=aws_config)
update_resource(OrganizationId, ResourceId, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = workmail("UpdateResource", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OrganizationId"=>OrganizationId, "ResourceId"=>ResourceId), params)); aws_config=aws_config)


text:
# # Working with geometry objects

# The `SimpleSDMLayers` package uses `Point`s to represent coordinates, which
# allows to easily use `GeometryBasics` objects for masking. In this example, we
# will illustrate how we can get the values around a given point, and within a
# polygon. These functions all rely on `mask` to extract the values.

using SimpleSDMLayers
using GeometryBasics
using Plots
using JSON

layer = SimpleSDMPredictor(WorldClim, BioClim; resolution=5.0, left=-89., right=-70., top=27., bottom=15.)

# Let's have a look at the data, before applying any transformation:

plot(layer)

# We will now define a center of 5 degree of radius centered on La Habana

la_habana = Point(-82.38304, 23.13302)
area = Circle(la_habana, 5.0)

# We can plot the background of the map, and add the clipped region:

plot(layer, c=:lightgrey, frame=:box)
plot!(mask(area, layer), c=:turku)
scatter!(la_habana, lab="", c=:white, msw=2.0)

# This approach is useful if you want to mask according to a polygon. In this
# case, we will keep the values within a polygon representing Cuba. We grab data
# from Natural Earth Resources, that do not have the best resolution in terms of
# borders, but are sufficient for this illustration:

borders = download("https://raw.githubusercontent.com/AshKyd/geojson-regions/master/countries/50m/CUB.geojson")
cuba_data = JSON.parsefile(borders)
polys = cuba_data["geometry"]["coordinates"]
CUBA = SimpleSDMLayers._format_polygon.(polys)

# This object is actually a multi-polygon, or an array of polygons. The `mask`
# function can handle this:

plot(layer, c=:lightgrey, frame=:box)
plot!(mask(CUBA, layer), c=:turku)
scatter!(la_habana, lab="", c=:white, msw=2.0)

# The delimitation of the area to crop is only as good as the underlying GeoJSON
# polygons, which in this case is missing some coastal areas. As a sidenote, the
# *center* of the grid cell is checked for being in the polygon (not *any*
# coordinate within the grid cell) - for this reason, coarser rasters (*e.g.* at
# 10 minutes resolution) may not respond perfectly well to masking in this way.

ext: jl


text:
#=Copyright (c) 2017 Gabriel Goh

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.=#

srand(1)

n = 2
U = [1 -1;1 1]/sqrt(2); L = [1 0; 0 2];
A = U*L*inv(U)
b = -ones(n)

β = 0.4
α = 1/max(eig(A)[1]...)

function runmomentum(A,b,k)
  z = zeros(length(b))
  w = zeros(length(b))
  for i = 1:k
    z = β*z + (A*w - b)
    w = w - α*z
  end
  return (z,w)
end

function geosumgen(R)
  Λ, U = eig(R)
  (b,k) -> begin;
    Λsum = (1./(1 - Λ)).*(1 - Λ.^k);
    real(U*(Λsum.*(U\b)));
  end
end

function runmomentumcheat(A,b,k)
  Λ, U = eig(A)
  Rmat(i) = [    β        Λ[i]  ;
              -α*β  (1- α*Λ[i]) ]
  S = inv([ 1  0 ;
            α  1 ])
  c = -U'b
  fcoll = [geosumgen(Rmat(i)) for i = 1:length(b)]
  iters = [fcoll[i](S*[c[i];0],k) for i = 1:length(b)]
  catiter = cat(2,iters...)
  return (U*catiter[1,:], U*catiter[2,:])
end

(a1,b1) = runmomentum(A,b,4)
(a2,b2) = runmomentumcheat(A,b,4)

norm(a1)

max_stars_repo_name: sbeleidy/post--momentum

max_issues_repo_name: sbeleidy/post--momentum

max_forks_repo_name: sbeleidy/post--momentum


text:
# Greetings! from path ~/.julia/config/startup.jl
# Greetings! from path ~/.julia/config/startup.jl
using SeisIO, SeisNoise, Dates, Glob
export FFT

"""
    get_allfile_path(Parameters)

get all files path --> files

# Arguments
- `Parameters::Dict{String,Any}`: ...
"""
function get_allfile_path_fft(
    select_file::Bool,
    FILETXT::String,
    DATADIR::String,
    select_sta::String,
    STATXT::String,
    channel_regular::String,
)
    # get all files path --> files
    if select_file == true
        files = readlines(FILETXT)
    else
        if select_sta == "no"
            files = sort(glob("*/*/*/$(channel_regular)", DATADIR))
        elseif select_sta == "sta"
            # a.glob DATADIR --> rfiles, N_rfiles
            rfiles = sort(glob("*/*/*/$(channel_regular)", DATADIR))
            N_rfiles = size(rfiles, 1)
            # b.read STATXT --> station_txt
            station_txt = readlines(STATXT)
            N_sta = size(station_txt, 1)
            # c.get all stations --> All_NET_STA
            All_NET_STA = Vector{Vector{String}}(undef, N_sta)
            for ll = 1:N_sta
                D_net, D_sta = split(station_txt[ll])
                All_NET_STA[ll] = [string(D_net), string(D_sta)]
            end
            # d.select data path with selected 'All_NET_STA'  --> files
            files = Vector{String}(undef, 0)
            read_mark = -1
            for jj = 1:N_rfiles
                for ii = 1:N_sta
                    file = rfiles[jj]
                    if occursin(All_NET_STA[ii][1], basename(file)) &&
                       occursin(All_NET_STA[ii][2], basename(file))
                        read_mark = 1
                        push!(files, file)
                    end
                end
            end
            # e.no stations in DATADIR --> files=[]
            if read_mark == -1
                files = []
            end
        end
    end
    return files
end

function get_SeisData_fft(Onefile_path::String, input_fmt::String,freqmin::Float64, freqmax::Float64)
    S = SeisData()
    try
        S_one = read_data(input_fmt, Onefile_path)
        detrend!(S_one)
        taper!(S_one)
        bandpass!(S_one, freqmin, freqmax, corners = 4, zerophase = false)
        append!(S, S_one)
    catch e
        println("Errorpass in function 'get_SeisData_fft':", e)
    end
    return S
end

function get_SeisData2RawData_fft(S::SeisData, cc_len::Int64, cc_step::Int64)
    R = RawData(S, cc_len, cc_step)
    return R
end

function get_time_norm_fft(
    R::RawData,
    time_norm::String,
    factor_clip_std::Float64,
    factor_mute::Float64,
    time_half_win::Int64,
)
    if time_norm == "no"
        nothing
    elseif time_norm == "one_bit"
        onebit!(R)
    elseif time_norm == "clip"
        clip!(R, factor_clip_std)
    elseif time_norm == "mute"
        mute!(R, factor_mute)
    elseif time_norm == "smooth"
        smooth!(R.x, time_half_win)
    end
    return R
end

function get_rfft_fft(R::RawData, cc_method::String)
    Fs = FFTData()
    if cc_method == "CC"
        Fs = rfft(R)
    elseif cc_method == "PCC"
        Fs = phase(R)
    end
    return Fs
end

function get_freq_norm_fft(
    Fs::FFTData,
    freq_norm::String,
    freqmin::Float64,
    freqmax::Float64,
    freq_half_win::Int64,
)
    if freq_norm == "no"
        nothing
    elseif freq_norm == "whiten"
        whiten!(Fs, freqmin, freqmax)
    elseif freq_norm == "coherence"
        coherence!(Fs, freq_half_win)
    elseif freq_norm == "deconvolution"
        deconvolution!(Fs, freq_half_win)
    end
    return Fs
end

function get_save_fft_fft(Fs::FFTData, Onefile_path::String, FFTDIR::String)
    raw_filepath = splitpath(Onefile_path)
    filepath =
        joinpath(FFTDIR, raw_filepath[end-3], raw_filepath[end-2], raw_filepath[end-1])
    if !isdir(filepath)
        mkpath(filepath)
    end
    save_fft(Fs, filepath)
    return nothing
end

function main_fft(Onefile_path::String, Parameters::Dict{String,Any})
    flag = Parameters["flag"]
    input_fmt = Parameters["input_fmt"]
    rm_resp = Parameters["rm_resp"]
    respdir = Parameters["respdir"]
    cc_len = Parameters["cc_len"]
    cc_step = Parameters["cc_step"]
    time_norm = Parameters["time_norm"]
    factor_clip_std = Parameters["factor_clip_std"]
    factor_mute = Parameters["factor_mute"]
    time_half_win = Parameters["time_half_win"]
    cc_method = Parameters["cc_method"]
    freq_norm = Parameters["freq_norm"]
    freqmin = Parameters["freqmin"]
    freqmax = Parameters["freqmax"]
    freq_half_win = Parameters["freq_half_win"]
    FFTDIR = Parameters["FFTDIR"]

    println("FFT file Onefile: $(Onefile_path) || now:", now())
    if flag == true
        ###### 1.read sac/mseed -> SeisData() ######
        tALL = @elapsed begin
            S = get_SeisData_fft(Onefile_path, input_fmt, freqmin, freqmax)
        end
        println("'Func:get_SeisData' took $tALL seconds")
        ###### 2.remove response ######
        #...
        ###### 3.SeisData() -> RawData() ######
        tALL = @elapsed begin
            R = get_SeisData2RawData_fft(S, cc_len, cc_step)
        end
        println("'Func:get_SeisData2RawData' took $tALL seconds")
        ###### 4.time_norm ######
        tALL = @elapsed begin
            R = get_time_norm_fft(R, time_norm, factor_clip_std, factor_mute, time_half_win)
        end
        println("'Func:get_time_norm' took $tALL seconds")
        ###### 5.fft ######
        tALL = @elapsed begin
            Fs = get_rfft_fft(R, cc_method)
        end
        println("'Func:get_rfft' took $tALL seconds")
        ###### 6.freq_norm ######
        tALL = @elapsed begin
            Fs = get_freq_norm_fft(Fs, freq_norm, freqmin, freqmax, freq_half_win)
        end
        println("'Func:get_freq_norm' took $tALL seconds")
        ###### 7.save_fft ######
        tALL = @elapsed begin
            get_save_fft_fft(Fs, Onefile_path, FFTDIR)
        end
        println("'Func:get_save_fft' took $tALL seconds")
    else
        ###### 1.read sac/mseed -> SeisData() ######
        S = get_SeisData_fft(Onefile_path, input_fmt, freqmin, freqmax)
        ###### 2.remove response ######
        #...
        ###### 3.SeisData() -> RawData() ######
        R = get_SeisData2RawData_fft(S, cc_len, cc_step)
        ###### 4.time_norm ######
        R = get_time_norm_fft(R, time_norm, factor_clip_std, factor_mute, time_half_win)
        ###### 5.fft ######
        Fs = get_rfft_fft(R, cc_method)
        ###### 6.freq_norm ######
        Fs = get_freq_norm_fft(Fs, freq_norm, freqmin, freqmax, freq_half_win)
        ###### 7.save_fft ######
        get_save_fft_fft(Fs, Onefile_path, FFTDIR)
    end
    return nothing
end

function FFT(
    cores::Int64,
    flag::Bool,
    precompile::Bool,
    FFTDIR::String,
    select_file::Bool,
    FILETXT::String,
    DATADIR::String,
    select_sta::String,
    STATXT::String,
    input_fmt::String,
    time_norm::String,
    freq_norm::String,
    cc_method::String,
    channel_regular::String,
    rm_resp::String,
    respdir::String,
    freqmin::Float64,
    freqmax::Float64,
    cc_len::Int64,
    cc_step::Int64,
    factor_clip_std::Float64,
    factor_mute::Float64,
    time_half_win::Int64,
    freq_half_win::Int64,
)

    ### a. parameters --> Dict-Parameters
    Parameters = Dict(
        "cores" => cores,
        "flag" => flag,
        "FFTDIR" => FFTDIR,
        "select_file" => select_file,
        "FILETXT" => FILETXT,
        "DATADIR" => DATADIR,
        "select_sta" => select_sta,
        "STATXT" => STATXT,
        "input_fmt" => input_fmt,
        "time_norm" => time_norm,
        "freq_norm" => freq_norm,
        "cc_method" => cc_method,
        "channel_regular" => channel_regular,
        "rm_resp" => rm_resp,
        "respdir" => respdir,
        "freqmin" => freqmin,
        "freqmax" => freqmax,
        "cc_len" => cc_len,
        "cc_step" => cc_step,
        "factor_clip_std" => factor_clip_std,
        "factor_mute" => factor_mute,
        "time_half_win" => time_half_win,
        "freq_half_win" => freq_half_win,
    )

    ### b. get_allfile_path
    files =
        get_allfile_path_fft(select_file, FILETXT, DATADIR, select_sta, STATXT, channel_regular)
    N_files = size(files, 1)

    ### c. precompile
    if precompile == true
        println("precompile begin...")
        tALL_pre = @elapsed begin
            pmap(main_fft, [files[1]], [Parameters])
            toremove = glob("*/*/*/*", FFTDIR)
            rm.(toremove)
        end
        println("      precompile took $tALL_pre seconds")
        println("precompile end...")
    end

    ### d. run
    println("\n\n******************* START ******************")
    println("Beginning FFT with $(cores) processors... || N_files: $(N_files)")
    tALL = @elapsed begin
        pmap(main_fft, files, fill(Parameters, N_files))
    end
    println("FFT took $tALL seconds")
    println("******************* END ******************\n\n")
end

max_stars_repo_name: OUCyf/NoiseCC

max_issues_repo_name: OUCyf/NoiseCC

max_forks_repo_name: OUCyf/NoiseCC


text:
const _cache = Dict{AbstractString,Array}()

function fetch_word_list(filename::AbstractString)
  haskey(_cache, filename) && return _cache[filename]
  try
    io = open(filename, "r")
    words = map(x -> chomp(x), readlines(io))
    close(io)
    ret = convert(Array{String,1}, words)
    _cache[filename] = ret
    return ret
  catch
    error("Failed to fetch word list from $(filename)")
  end
end


text:
using Pkg
Pkg.activate(".")

using Distributions
using LinearAlgebra
using ControlSystems
using JuMP
using Convex
using BSON: @save, @load

using MosekTools
using Mosek

using Plots
using StatsPlots
plotlyjs()

includet("./utils.jl")
includet("./models/ffREN.jl")

# First experiment
η = 1E-1
nx = 50
nv = 500

# Sample simple discrete time system
# Pole locations in polar coordinates
ρ = 0.80
ϕ = 2 * pi / 10
λ = [ρ * cos(ϕ) + ρ * sin(ϕ) * im, ρ * cos(ϕ) - ρ * sin(ϕ) * im]

sys = zpk([], λ, 0.3, 1.0)

Pdy(d) = lsim(sys, d, 1:size(d, 1))[1]
Puy(d) = lsim(sys, d, 1:size(d, 1))[1]

# Sample disurbance and simulate response to that distribution
amp = 10
samples, hold = 500, 50
# samples, hold = 200, 50
function sample_disturbance()
    d = 2 * amp * (rand(samples, 1) .- 0.5)
    d = kron(d, ones(hold, 1))
    return d
end
d = sample_disturbance()

pgfplotsx()
c = palette(:default);
lw = 1.5
plot_font = "Computer Modern"

default(fontfamily=plot_font, labelfontsize=22, legendfontsize=18, tickfontsize=16,
        linewidth=2, framestyle=:box, label=nothing, grid=true)

p=plot(d[1:1000]; label="Example Disturbance", xlabel="Time Steps", legend=(0.51, 0.99))
savefig(p, "./results/youla_example_disturbance.pdf")

# Simulate system with disturbance
b = Pdy(d)

plot(d)
plot!(b)

# Sample ESN and simulate effect of output
# Q_param = implicit_ff_cell(1, nx, nv)
Q_param = sample_ff_ren(1, nx, nv)
function Q(v)
    x0 = init_state(Q_param, size(v, 2))
    xt, wt = simulate(Q_param, x0, v)

    X = reduce(hcat, xt)
    W = reduce(hcat, wt)

    return [X' W' v ones(size(v, 1), 1)]   # include ones for bias term
end

C = Q(-b)
A = reduce(hcat, Puy(ci) for ci in eachslice(C, dims=2))

# Optimize!
θv = Convex.Variable(size(A, 2))

y = A * θv + b
u = C * θv

J = norm(y, 1) + η * norm(θv, 2) + 1E-3*sumsquares(u)
constraints = [u < 5.0, u > -5.0]

problem = minimize(J, constraints)
Convex.solve!(problem, Mosek.Optimizer)

θ = evaluate(θv)

# linear system
λ = 1 - 1E-1
q = 2nx + nv
A = randn(q, q) / sqrt(q)
ρ = maximum(abs.(eigvals(A)))
A = λ * A / ρ
B = randn(q, 1) / sqrt(q)
function Q_lin(v)
    X = zeros(size(v, 1), size(A, 1))
    for t in 1:size(v, 1) - 1
        X[t + 1, :] = A * X[t,:] + B * v[t,:]
    end
    return X
end

Clin = Q_lin(-b)
Alin = reduce(hcat, Puy(ci) for ci in eachslice(Clin, dims=2))

# Optimize!
θv = Convex.Variable(size(Alin, 2))

y = Alin * θv + b
u = Clin * θv

J = norm(y, 1) + η * norm(θv, 2)
constraints = [u < 4.0, u > -4.0]

problem = minimize(J, constraints)
Convex.solve!(problem, Mosek.Optimizer)

θlin = evaluate(θv)

# Test input
amps = range(0, length=7, stop=8)
d_test = reduce(hcat, a .* [ones(1, 50) zeros(1, 50)] for a in amps)'

btest = Pdy(d_test)
Ctest = Q(-btest)
Atest = reduce(hcat, Puy(ci) for ci in eachslice(Ctest, dims=2))

Ctest_lin = Q_lin(-btest)
Atest_lin = reduce(hcat, Puy(ci) for ci in eachslice(Ctest_lin, dims=2))

# Resulting signals
ytest = Atest * θ + btest
utest = Ctest * θ

ytest_lin = Atest_lin * θlin + btest
utest_lin = Ctest_lin * θlin

# --------------------------- Plotting ----------------------------------------------------
pgfplotsx()
c = palette(:default);
lw = 1.5
plot_font = "Computer Modern"

default(fontfamily=plot_font, labelfontsize=22, legendfontsize=18, tickfontsize=16,
        linewidth=2, framestyle=:box, label=nothing, grid=true)

T0 = 25

plot(d_test[T0:end]; label="Disturbance", lw=2.0)
plot!(Pdy(d_test)[T0:end]; label="Open Loop", lw=lw)
plot!(ytest_lin[T0:end]; label="Linear", lw=lw, c=c[4])
plot!(ytest[T0:end]; label="aREN", lw=lw, c=c[3])
plot!(;xlabel="Time Steps", legend=(0.02, 0.98))
p = plot!()
savefig(p, "./results/youla/disturbance_rejection.pdf")

# Control input figure

p = plot(utest_lin[T0:end]; label="Linear", lw=lw, c=c[4])
p = plot!(utest[T0:end]; label="aREN", lw=lw, c=c[3])
plot!([0, length(utest) - T0], [-5, -5]; label="Contraints", c=:black, ls=:dash, lw=2.0)
plot!(;xlabel="Time Steps", legend=(0.02, 0.98))
savefig(p, "./results/youla/control.pdf")

max_stars_repo_name: imanchester/REN

max_issues_repo_name: imanchester/REN

max_forks_repo_name: imanchester/REN


text:
using ReinforcementLearning,
      ReinforcementLearningEnvironmentDiscrete,
      ReinforcementLearningEnvironmentClassicControl,
      ReinforcementLearningEnvironmentGym,
      ReinforcementLearningEnvironmentAtari,
      BenchmarkTools,
      Flux,
      Pkg,
      InteractiveUtils

versioninfo()
println()
Pkg.status()

env = CartPole()
rlsetup = RLSetup(
    ActorCriticPolicyGradient(ns = 4, na = 2, α = .02, nsteps = 25),
    env,
    ConstantNumberSteps(400),
)
println("\n\nCartPole ActorCriticPolicyGradient")
show(stdout, "text/plain", @benchmark(learn!($rlsetup)))

env = GymEnv("CartPole-v0")
rlsetup = RLSetup(
    ActorCriticPolicyGradient(ns = 4, na = 2, α = .02, nsteps = 25),
    env,
    ConstantNumberSteps(400),
)
println("\n\nCartPoleGym ActorCriticPolicyGradient")
show(stdout, "text/plain", @benchmark(learn!($rlsetup)))

learner = DQN(
    Chain(Dense(4, 16, relu), Dense(16, 32, relu), Dense(32, 2)),
    updateevery = 1,
    updatetargetevery = 200,
    startlearningat = 200,
    minibatchsize = 16,
    replaysize = 10^3,
)
rlsetup = RLSetup(learner, env, ConstantNumberSteps(400))
println("\n\nCartPole DQN")
show(stdout, "text/plain", @benchmark(learn!($rlsetup)))

env = MountainCar(maxsteps = 10^4)
preprocessor = TilingStateAggregator(StateAggregator([-1.2, -.07], [.5, .07], [8, 8]), 8)
rlsetup = RLSetup(
    Sarsa(ns = 8 * 8^2, na = 3, α = 1 / 8, λ = .96, γ = 1.0),
    env,
    ConstantNumberSteps(400),
    preprocessor = preprocessor,
)
rlsetup.policy.ϵ = 0
println("\n\nMountainCar TilingSarsa")
show(stdout, "text/plain", @benchmark(learn!($rlsetup)))

env = DiscreteMaze(ngoals = 5)
ns = length(env.mdp.isterminal)
rlsetup = RLSetup(SmallBackups(na = 4, ns = ns, γ = .99), env, ConstantNumberSteps(400))
println("\n\nDiscreteMaze SmallBackups")
show(stdout, "text/plain", @benchmark(learn!($rlsetup)))

env = AtariEnv("breakout")
model = Chain(
    x -> x ./ Float64(255),
    Conv((8, 8), 4 => 16, relu, stride = (4, 4)),
    x -> reshape(x, :, size(x, 4)),
    Dense(6400, length(env.actions)),
);
learner = DQN(
    model,
    opttype = x -> Flux.SGD(x, .0001),
    loss = huberloss,
    doubledqn = true,
    updatetargetevery = 2500,
    nsteps = 10,
    minibatchsize = 8,
    updateevery = 4,
    replaysize = 10^5,
    nmarkov = 4,
    startlearningat = 200,
);
preprocessor = ImagePreprocessor(
    (160, 210),
    [ImageResizeNearestNeighbour((84, 84)), x -> reshape(x, (84, 84, 1))],
)
rlsetup = RLSetup(learner, env, ConstantNumberSteps(400), preprocessor = preprocessor)
println("\n\nAtari DQN")
show(stdout, "text/plain", @benchmark(learn!($rlsetup), samples = 10, seconds = 30))


text:
# Residual Sum of Squares
function compute_objval_rss(
        sim_data::Vector{Float64},
        exp_data::Vector{Float64})::Float64
    error::Float64 = 0.0
    for i in eachindex(exp_data)
        @inbounds error += (sim_data[i] - exp_data[i])^2
    end
    return error
end

# Cosine similarity
#=
function compute_objval_cos(
        sim_data::Vector{Float64},
        exp_data::Vector{Float64})::Float64
    error::Float64 = 1.0 - dot(sim_data, exp_data) / (norm(sim_data) * norm(exp_data))
    return error
end =#

function conditions_index(condition_name::String)::Union{Int,Nothing}
    if !(condition_name in Sim.conditions)
        error("$condition_name is not defined in Sim.conditions.")
    end
    return findfirst(isequal(condition_name), Sim.conditions)
end

function diff_sim_and_exp(
        sim_matrix::Matrix{Float64},
        exp_dict::Dict{String,Array{Float64,1}},
        exp_timepoint::Vector{Float64},
        conditions::Vector{String};
        sim_norm_max::Float64)::Tuple{Vector{Float64},Vector{Float64}}
    sim_result::Vector{Float64} = []
    exp_result::Vector{Float64} = []

    for (idx, condition) in enumerate(conditions)
        if condition in keys(exp_dict)
            append!(sim_result, sim_matrix[Int.(exp_timepoint .+ 1),idx])
            append!(exp_result, exp_dict[condition])
        end
    end

    return (sim_result ./ sim_norm_max, exp_result)
end

# Define an objective function to be minimized.
function objective(indiv_gene::Vector{Float64})::Float64
    indiv::Vector{Float64} = decode_gene2val(indiv_gene)

    (p, u0) = update_param(indiv)

    if Sim.simulate!(p, u0) isa Nothing
        error::Vector{Float64} = zeros(
            length(["MCF7", "BT474", "MDAMB231", "SKBR3"]) * length(observables) * length(["EGF", "HRG"])
        )
        for (i, cell_line) in enumerate(["MCF7", "BT474", "MDAMB231", "SKBR3"])
            for (j, obs_name) in enumerate(observables)
                sim_norm_max = maximum(
                    Sim.simulations[observables_index(obs_name),:,[conditions_index(cell_line * "_EGF"),conditions_index(cell_line * "_HRG")]]
                )
                exp_t = Exp.get_timepoint(obs_name)
                error[(i - 1) * length(observables) * length(["EGF", "HRG"]) + (j - 1) * length(["EGF", "HRG"]) + 1] = compute_objval_rss(
                    Sim.simulations[observables_index(obs_name), Int.(exp_t .+ 1), conditions_index(cell_line * "_EGF")] ./ sim_norm_max,
                    Exp.experiments[observables_index(obs_name)][cell_line * "_EGF"]
                )
                error[(i - 1) * length(observables) * length(["EGF", "HRG"]) + (j - 1) * length(["EGF", "HRG"]) + 2] = compute_objval_rss(
                    Sim.simulations[observables_index(obs_name), Int.(exp_t .+ 1), conditions_index(cell_line * "_HRG")] ./ sim_norm_max,
                    Exp.experiments[observables_index(obs_name)][cell_line * "_HRG"]
                )
            end
        end
        return sum(error)
    else
        return Inf
    end
end


text:
#Functions

function sayhi(name)
    println("Hi $name")
end

sayhi("R2-D2")

f(x)=x^2
f(12)

#Same for previous, e.g.
sayhello(name) = println("Hello $name")
sayhello("Dudu")

saygreetings = name -> println("Greetings $name")
saygreetings("General")

#Mutating
v = [3,5,2]
sort(v)
display(v)
sort!(v)
display(v)

#Broadcasting
A = [i+3*j for j in 0:2, i in 1:3]
display(A)
f(A) #Inmultire de matrici
f.(A) #Inmultire de elemente

max_stars_repo_name: luca-mm/Bachelor-Thesis

max_issues_repo_name: luca-mm/Bachelor-Thesis

max_forks_repo_name: luca-mm/Bachelor-Thesis


text:
push!(LOAD_PATH, "../src/")
using Documenter, GeoArrayOps

makedocs(
    sitename="GeoArrayOps.jl",
    pages=[
        "index.md",
        "Tutorials" => [],
        "Topics" => [],
        "Reference" => "reference.md",
        "How-To Guides" => [],
    ]
)

deploydocs(
    repo="github.com/Deltares/GeoArrayOps.jl.git",
)


text:
# Copied from DiffEqDevTools.jl and modified
function DiffEqDevTools.appxtrue(sol::ProbODESolution, sol2::TestSolution)

    # (almost) everything should work on the mean solution
    sol = mean(sol)

    if sol2.u == nothing && DiffEqDevTools.hasinterp(sol2)
        _sol = TestSolution(sol.t, sol2(sol.t), sol2)
    else
        _sol = sol2
    end

    errors = Dict(:final => DiffEqDevTools.recursive_mean(abs.(sol[end] - _sol[end])))
    if _sol.dense
        timeseries_analytic = _sol(sol.t)
        ts_err = sol - timeseries_analytic
        errors[:l∞] = maximum(DiffEqDevTools.vecvecapply((x) -> abs.(x), ts_err))
        errors[:l2] = sqrt(
            DiffEqDevTools.recursive_mean(
                DiffEqDevTools.vecvecapply((x) -> float(x) .^ 2, ts_err),
            ),
        )

        if sol.dense
            densetimes = collect(range(sol.t[1], stop=sol.t[end], length=100))
            interp_u = sol(densetimes)
            interp_analytic = _sol(densetimes)
            interp_err = interp_u - interp_analytic
            interp_errors = Dict(
                :L∞ => maximum(DiffEqDevTools.vecvecapply((x) -> abs.(x), interp_err)),
                :L2 => sqrt(
                    DiffEqDevTools.recursive_mean(
                        DiffEqDevTools.vecvecapply((x) -> float(x) .^ 2, interp_err),
                    ),
                ),
            )
            errors = merge(errors, interp_errors)
        end
    else
        timeseries_analytic = sol2.u
        if sol.t == sol2.t
            ts_err = sol - timeseries_analytic
            errors[:l∞] = maximum(vecvecapply((x) -> abs.(x), ts_err))
            errors[:l2] = sqrt(recursive_mean(vecvecapply((x) -> float(x) .^ 2, ts_err)))
        end
    end
    return DiffEqBase.build_solution(sol, timeseries_analytic, errors)
end


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

"""
    DeleteLexicon()

Deletes the specified pronunciation lexicon stored in an AWS Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the GetLexicon or ListLexicon APIs. For more information, see Managing Lexicons.

# Required Parameters
- `LexiconName`: The name of the lexicon to delete. Must be an existing lexicon in the region.

"""
delete_lexicon(LexiconName; aws_config::AWSConfig=global_aws_config()) = polly("DELETE", "/v1/lexicons/$(LexiconName)"; aws_config=aws_config)
delete_lexicon(LexiconName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = polly("DELETE", "/v1/lexicons/$(LexiconName)", args; aws_config=aws_config)

"""
    DescribeVoices()

Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.  When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices. For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from.  You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.  This operation requires permissions to perform the polly:DescribeVoices action.

# Optional Parameters
- `Engine`: Specifies the engine (standard or neural) used by Amazon Polly when processing input text for speech synthesis.
- `IncludeAdditionalLanguageCodes`: Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify yes but not if you specify no.
- `LanguageCode`:  The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned.
- `NextToken`: An opaque pagination token returned from the previous DescribeVoices operation. If present, this indicates where to continue the listing.
"""
describe_voices(; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/voices"; aws_config=aws_config)
describe_voices(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/voices", args; aws_config=aws_config)

"""
    GetLexicon()

Returns the content of the specified pronunciation lexicon stored in an AWS Region. For more information, see Managing Lexicons.

# Required Parameters
- `LexiconName`: Name of the lexicon.

"""
get_lexicon(LexiconName; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/lexicons/$(LexiconName)"; aws_config=aws_config)
get_lexicon(LexiconName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/lexicons/$(LexiconName)", args; aws_config=aws_config)

"""
    GetSpeechSynthesisTask()

Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.

# Required Parameters
- `TaskId`: The Amazon Polly generated identifier for a speech synthesis task.

"""
get_speech_synthesis_task(TaskId; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/synthesisTasks/$(TaskId)"; aws_config=aws_config)
get_speech_synthesis_task(TaskId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/synthesisTasks/$(TaskId)", args; aws_config=aws_config)

"""
    ListLexicons()

Returns a list of pronunciation lexicons stored in an AWS Region. For more information, see Managing Lexicons.

# Optional Parameters
- `NextToken`: An opaque pagination token returned from previous ListLexicons operation. If present, indicates where to continue the list of lexicons.
"""
list_lexicons(; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/lexicons"; aws_config=aws_config)
list_lexicons(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/lexicons", args; aws_config=aws_config)

"""
    ListSpeechSynthesisTasks()

Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.

# Optional Parameters
- `MaxResults`: Maximum number of speech synthesis tasks returned in a List operation.
- `NextToken`: The pagination token to use in the next request to continue the listing of speech synthesis tasks.
- `Status`: Status of the speech synthesis tasks returned in a List operation
"""
list_speech_synthesis_tasks(; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/synthesisTasks"; aws_config=aws_config)
list_speech_synthesis_tasks(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = polly("GET", "/v1/synthesisTasks", args; aws_config=aws_config)

"""
    PutLexicon()

Stores a pronunciation lexicon in an AWS Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation. For more information, see Managing Lexicons.

# Required Parameters
- `Content`: Content of the PLS lexicon as string data.
- `LexiconName`: Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long.

"""
put_lexicon(Content, LexiconName; aws_config::AWSConfig=global_aws_config()) = polly("PUT", "/v1/lexicons/$(LexiconName)", Dict{String, Any}("Content"=>Content); aws_config=aws_config)
put_lexicon(Content, LexiconName, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = polly("PUT", "/v1/lexicons/$(LexiconName)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Content"=>Content), args)); aws_config=aws_config)

"""
    StartSpeechSynthesisTask()

Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters (OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status.

# Required Parameters
- `OutputFormat`: The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.
- `OutputS3BucketName`: Amazon S3 bucket name to which the output file will be saved.
- `Text`: The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
- `VoiceId`: Voice ID to use for the synthesis.

# Optional Parameters
- `Engine`: Specifies the engine (standard or neural) for Amazon Polly to use when processing input text for speech synthesis. Using a voice that is not supported for the engine selected will result in an error.
- `LanguageCode`: Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).  If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
- `LexiconNames`: List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice.
- `OutputS3KeyPrefix`: The Amazon S3 key prefix for the output speech file.
- `SampleRate`: The audio frequency specified in Hz. The valid values for mp3 and ogg_vorbis are \"8000\", \"16000\", \"22050\", and \"24000\". The default value for standard voices is \"22050\". The default value for neural voices is \"24000\". Valid values for pcm are \"8000\" and \"16000\" The default value is \"16000\".
- `SnsTopicArn`: ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.
- `SpeechMarkTypes`: The type of speech marks returned for the input text.
- `TextType`: Specifies whether the input text is plain text or SSML. The default value is plain text.
"""
start_speech_synthesis_task(OutputFormat, OutputS3BucketName, Text, VoiceId; aws_config::AWSConfig=global_aws_config()) = polly("POST", "/v1/synthesisTasks", Dict{String, Any}("OutputFormat"=>OutputFormat, "OutputS3BucketName"=>OutputS3BucketName, "Text"=>Text, "VoiceId"=>VoiceId); aws_config=aws_config)
start_speech_synthesis_task(OutputFormat, OutputS3BucketName, Text, VoiceId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = polly("POST", "/v1/synthesisTasks", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OutputFormat"=>OutputFormat, "OutputS3BucketName"=>OutputS3BucketName, "Text"=>Text, "VoiceId"=>VoiceId), args)); aws_config=aws_config)

"""
    SynthesizeSpeech()

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.

# Required Parameters
- `OutputFormat`:  The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.  When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.
- `Text`:  Input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.
- `VoiceId`:  Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.

# Optional Parameters
- `Engine`: Specifies the engine (standard or neural) for Amazon Polly to use when processing input text for speech synthesis. For information on Amazon Polly voices and which voices are available in standard-only, NTTS-only, and both standard and NTTS formats, see Available Voices.  NTTS-only voices  When using NTTS-only voices such as Kevin (en-US), this parameter is required and must be set to neural. If the engine is not specified, or is set to standard, this will result in an error.  Type: String Valid Values: standard | neural  Required: Yes  Standard voices  For standard voices, this is not required; the engine parameter defaults to standard. If the engine is not specified, or is set to standard and an NTTS-only voice is selected, this will result in an error.
- `LanguageCode`: Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).  If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.
- `LexiconNames`: List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see PutLexicon.
- `SampleRate`: The audio frequency specified in Hz. The valid values for mp3 and ogg_vorbis are \"8000\", \"16000\", \"22050\", and \"24000\". The default value for standard voices is \"22050\". The default value for neural voices is \"24000\". Valid values for pcm are \"8000\" and \"16000\" The default value is \"16000\".
- `SpeechMarkTypes`: The type of speech marks returned for the input text.
- `TextType`:  Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML.
"""
synthesize_speech(OutputFormat, Text, VoiceId; aws_config::AWSConfig=global_aws_config()) = polly("POST", "/v1/speech", Dict{String, Any}("OutputFormat"=>OutputFormat, "Text"=>Text, "VoiceId"=>VoiceId); aws_config=aws_config)
synthesize_speech(OutputFormat, Text, VoiceId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = polly("POST", "/v1/speech", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("OutputFormat"=>OutputFormat, "Text"=>Text, "VoiceId"=>VoiceId), args)); aws_config=aws_config)


text:
# graphtheoryufrj.jl
# Authors : Heitor Guimaraes and Luiz Ciafrino
# @brief: Package control file with include of all files and functions.

module graphtheoryufrj
using DataStructures, Compat

export
	# Graph data structure
	simpleGraph,
	graph_properties,

	# Algorithms
	bfs,
	fast_bfs,
	dfs,
	connected_components,
	show_cycle,
	has_cycle,
	dia_bfs,
	diameter,
	dijkstra,
	floydw,
	prim_mst,
	mean_distance_dijkstra,
	mean_distance_fw,

	# Graph_Coloring
	direct_coloring,
	gurobi_coloring,
	edges,
	load,
	run,
	colors,
	coloring_correct,
	color_report,

	#DSATUR
	run_dsatur_heuristc,
	run_optdsatur_heuristc,
	dsatur,
	optdsatur,
	iteratedGreedy,
	localSearch,
	colorGraph,

	# Plot data
	plot_graph,
	plot_bfs,
	plot_dfs

# Load source files
include("graphstructure.jl")
include("algorithms.jl")
include("graph_coloring.jl")
include("dsatur.jl")
include("plot.jl")

end


text:
mutable struct VarGate <: QGate
	kernel::GateKernel
	param:: Vector
	VarGate(kernel::GateKernel, param::Vector) = new(kernel, param)
	VarGate(kernel::GateKernel) = new(kernel, zeros(paramCount(kernel)))
end # struct

VarGate(f::Function, paramCount::Int, name::String="Anonymous") = VarGate(GateKernel(f, paramCount,name))
VarGate(f::Function, param::Vector, name::String = "Anonymous") = VarGate(GateKernel(f, length(param), name), param)

name(gate::VarGate) = name(gate.kernel)
param(gate::VarGate) = gate.param
paramCount(gate::VarGate) = paramCount(gate.kernel)
copy(gate::VarGate) = VarGate(gate.kernel, copy(gate.param))
data(gate::VarGate) = func(gate)(param(gate)...)
func(gate::VarGate) = func(gate.kernel)
setParam!(gate::VarGate, newParams::Vector) = (gate.param = newParams)

control(gate::VarGate) = VarGate(control(gate.kernel), copy(gate.param))
==(gate1::VarGate, gate2::VarGate)= (gate1.kernel==gate2.kernel && gate1.param ==gate2.param)
inverse(gate::VarGate) = VarGate(inverse(gate.kernel), copy(gate.param))
function randomVarGate()
	choices = [Rx, Ry, Rz, Rϕ]
	param = 2π/rand(1:360)
	return VarGate(choices[rand(1:length(choices))], [param])
end

function show(io::IO,gate::VarGate)
	printstyled(io, name(gate); bold=true, color= :blue)
	print(io,", $(param(gate))\n")
end


text:
#=
Suppose an arithmetic expression is given as a binary tree. Each leaf is an integer and each internal node is one of '+', '−', '∗', or '/'.

Given the root to such a tree, write a function to evaluate it.

For example, given the following tree:

    *
   / \
  +    +
 / \  / \
3  2  4  5

You should return 45, as it is (3 + 2) * (4 + 5).
=#

using Test
include("Solutions/problem50_evaluate_arithmetic_binary_tree.jl")

tree = Node('*', Node('+', 3, 2), Node('+', 4, 5))
@test evaluate(tree) == 45

max_stars_repo_name: DominiqueCaron/daily-coding-problem

max_issues_repo_name: DominiqueCaron/daily-coding-problem

max_forks_repo_name: DominiqueCaron/daily-coding-problem


text:
using CUDA
using Adapt

include("../util/Matrix_utils.jl")
include("../util/Enum_Collection.jl")

struct Button{A,B,C}
    x_Coord::Int
    y_Coord::Int
    width::Int
    height::Int
    reward::Int
    matrix_clicked::A
    matrix_unclicked::B
    status::C
    resettable::Bool
    on_click_listener::On_click_listeners
end
Adapt.@adapt_structure Button

struct All_Buttons{A}
    app_close_button::A
    dropdown_button_datei::A
    dropdown_button_anzeigen::A
    dropdown_button_navigation::A
    dropdown_button_tools::A
    dropdown_button_hilfe::A
    small_button_1::A
    small_button_2::A
    small_button_3::A
    small_button_4::A
    small_button_5::A
    small_button_6::A
    small_button_7::A
    small_button_8::A
    small_button_9::A
    small_button_10::A
    small_button_11::A
    small_button_12::A
    small_button_13::A
end
Adapt.@adapt_structure All_Buttons

struct Window{A,B,C,D}
    matrix_self::A
    current_matrix::D
    x_Coord::Int
    y_Coord::Int
    width::Int
    height::Int
    windows::B
    buttons::C
    modal::Bool
    autoclose::Bool
end
Adapt.@adapt_structure Window

struct All_Windows{A}
    main_window::A
end
Adapt.@adapt_structure All_Windows


text:
using Gnuplot
x = LinRange(-10,10,200)
fg(x,μ,σ) = exp.(.-(x.-μ).^2 ./(2σ^2))./(σ*√(2π))
@gp x fg(x, 0.25, 1.5) "w filledcurves lc '#E69F00' t '0.25,1.5'"
@gp :- "set style fill transparent solid 0.5 noborder"
@gp :- "set key title 'μ,σ' box 3" xlab = "x" ylab = "P(x)"
@gp :- x fg(x, 2, 1) "w filledcu lc rgb '#56B4E9' t '2,1' fs transparent solid 0.25"
@gp :- x fg(x, -1, 2) "w filledcu lc '#009E73' t '-1,2' fs transparent solid 0.1"
save(term="pngcairo size 600,400", output="./code/plt_ex14.png") # hide

max_stars_repo_name: lazarusA/gnuplot-examples

max_issues_repo_name: lazarusA/gnuplot-examples

max_forks_repo_name: lazarusA/gnuplot-examples


text:
@testset "413.arithmetic-slices.jl" begin
    @test number_of_arithmetic_slices([1, 2, 3, 4]) == 3
    @test number_of_arithmetic_slices([1, 3, 5, 7, 9, 15, 20, 25, 28, 29]) == 7
end