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

"""
    add_instance_fleet(cluster_id, instance_fleet)
    add_instance_fleet(cluster_id, instance_fleet, params::Dict{String,<:Any})

Adds an instance fleet to a running cluster.  The instance fleet configuration is available
only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x.

# Arguments
- `cluster_id`: The unique identifier of the cluster.
- `instance_fleet`: Specifies the configuration of the instance fleet.

"""
add_instance_fleet(ClusterId, InstanceFleet; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddInstanceFleet", Dict{String, Any}("ClusterId"=>ClusterId, "InstanceFleet"=>InstanceFleet); aws_config=aws_config)
add_instance_fleet(ClusterId, InstanceFleet, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddInstanceFleet", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId, "InstanceFleet"=>InstanceFleet), params)); aws_config=aws_config)

"""
    add_instance_groups(instance_groups, job_flow_id)
    add_instance_groups(instance_groups, job_flow_id, params::Dict{String,<:Any})

Adds one or more instance groups to a running cluster.

# Arguments
- `instance_groups`: Instance groups to add.
- `job_flow_id`: Job flow in which to add the instance groups.

"""
add_instance_groups(InstanceGroups, JobFlowId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddInstanceGroups", Dict{String, Any}("InstanceGroups"=>InstanceGroups, "JobFlowId"=>JobFlowId); aws_config=aws_config)
add_instance_groups(InstanceGroups, JobFlowId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddInstanceGroups", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("InstanceGroups"=>InstanceGroups, "JobFlowId"=>JobFlowId), params)); aws_config=aws_config)

"""
    add_job_flow_steps(job_flow_id, steps)
    add_job_flow_steps(job_flow_id, steps, params::Dict{String,<:Any})

AddJobFlowSteps adds new steps to a running cluster. A maximum of 256 steps are allowed in
each job flow. If your cluster is long-running (such as a Hive data warehouse) or complex,
you may require more than 256 steps to process your data. You can bypass the 256-step
limitation in various ways, including using SSH to connect to the master node and
submitting queries directly to the software running on the master node, such as Hive and
Hadoop. For more information on how to do this, see Add More than 256 Steps to a Cluster in
the Amazon EMR Management Guide. A step specifies the location of a JAR file stored either
on the master node of the cluster or in Amazon S3. Each step is performed by the main
function of the main class of the JAR file. The main class can be specified either in the
manifest of the JAR or by using the MainFunction parameter of the step. Amazon EMR executes
each step in the order listed. For a step to be considered complete, the main function must
exit with a zero exit code and all Hadoop jobs started while the step was running must have
completed and run successfully. You can only add steps to a cluster that is in one of the
following states: STARTING, BOOTSTRAPPING, RUNNING, or WAITING.

# Arguments
- `job_flow_id`: A string that uniquely identifies the job flow. This identifier is
  returned by RunJobFlow and can also be obtained from ListClusters.
- `steps`:  A list of StepConfig to be executed by the job flow.

"""
add_job_flow_steps(JobFlowId, Steps; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddJobFlowSteps", Dict{String, Any}("JobFlowId"=>JobFlowId, "Steps"=>Steps); aws_config=aws_config)
add_job_flow_steps(JobFlowId, Steps, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddJobFlowSteps", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("JobFlowId"=>JobFlowId, "Steps"=>Steps), params)); aws_config=aws_config)

"""
    add_tags(resource_id, tags)
    add_tags(resource_id, tags, params::Dict{String,<:Any})

Adds tags to an Amazon EMR resource. Tags make it easier to associate clusters in various
ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For
more information, see Tag Clusters.

# Arguments
- `resource_id`: The Amazon EMR resource identifier to which tags will be added. This value
  must be a cluster identifier.
- `tags`: A list of tags to associate with a cluster and propagate to EC2 instances. Tags
  are user-defined key-value pairs that consist of a required key string with a maximum of
  128 characters, and an optional value string with a maximum of 256 characters.

"""
add_tags(ResourceId, Tags; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddTags", Dict{String, Any}("ResourceId"=>ResourceId, "Tags"=>Tags); aws_config=aws_config)
add_tags(ResourceId, Tags, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("AddTags", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceId"=>ResourceId, "Tags"=>Tags), params)); aws_config=aws_config)

"""
    cancel_steps(cluster_id, step_ids)
    cancel_steps(cluster_id, step_ids, params::Dict{String,<:Any})

Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions
4.8.0 and later, excluding version 5.0.0. A maximum of 256 steps are allowed in each
CancelSteps request. CancelSteps is idempotent but asynchronous; it does not guarantee that
a step will be canceled, even if the request is successfully submitted. You can only cancel
steps that are in a PENDING state.

# Arguments
- `cluster_id`: The ClusterID for the specified steps that will be canceled. Use RunJobFlow
  and ListClusters to get ClusterIDs.
- `step_ids`: The list of StepIDs to cancel. Use ListSteps to get steps and their states
  for the specified cluster.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"StepCancellationOption"`: The option to choose to cancel RUNNING steps. By default, the
  value is SEND_INTERRUPT.
"""
cancel_steps(ClusterId, StepIds; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CancelSteps", Dict{String, Any}("ClusterId"=>ClusterId, "StepIds"=>StepIds); aws_config=aws_config)
cancel_steps(ClusterId, StepIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CancelSteps", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId, "StepIds"=>StepIds), params)); aws_config=aws_config)

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

Creates a security configuration, which is stored in the service and can be specified when
a cluster is created.

# Arguments
- `name`: The name of the security configuration.
- `security_configuration`: The security configuration details in JSON format. For JSON
  parameters and examples, see Use Security Configurations to Set Up Cluster Security in the
  Amazon EMR Management Guide.

"""
create_security_configuration(Name, SecurityConfiguration; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CreateSecurityConfiguration", Dict{String, Any}("Name"=>Name, "SecurityConfiguration"=>SecurityConfiguration); aws_config=aws_config)
create_security_configuration(Name, SecurityConfiguration, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CreateSecurityConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Name"=>Name, "SecurityConfiguration"=>SecurityConfiguration), params)); aws_config=aws_config)

"""
    create_studio(auth_mode, default_s3_location, engine_security_group_id, name, service_role, subnet_ids, user_role, vpc_id, workspace_security_group_id)
    create_studio(auth_mode, default_s3_location, engine_security_group_id, name, service_role, subnet_ids, user_role, vpc_id, workspace_security_group_id, params::Dict{String,<:Any})

Creates a new Amazon EMR Studio.

# Arguments
- `auth_mode`: Specifies whether the Studio authenticates users using single sign-on (SSO)
  or IAM. Amazon EMR Studio currently only supports SSO authentication.
- `default_s3_location`: The Amazon S3 location to back up Amazon EMR Studio Workspaces and
  notebook files.
- `engine_security_group_id`: The ID of the Amazon EMR Studio Engine security group. The
  Engine security group allows inbound network traffic from the Workspace security group, and
  it must be in the same VPC specified by VpcId.
- `name`: A descriptive name for the Amazon EMR Studio.
- `service_role`: The IAM role that will be assumed by the Amazon EMR Studio. The service
  role provides a way for Amazon EMR Studio to interoperate with other AWS services.
- `subnet_ids`: A list of subnet IDs to associate with the Amazon EMR Studio. A Studio can
  have a maximum of 5 subnets. The subnets must belong to the VPC specified by VpcId. Studio
  users can create a Workspace in any of the specified subnets.
- `user_role`: The IAM user role that will be assumed by users and groups logged in to an
  Amazon EMR Studio. The permissions attached to this IAM role can be scoped down for each
  user or group using session policies.
- `vpc_id`: The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate with the
  Studio.
- `workspace_security_group_id`: The ID of the Amazon EMR Studio Workspace security group.
  The Workspace security group allows outbound network traffic to resources in the Engine
  security group, and it must be in the same VPC specified by VpcId.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: A detailed description of the Amazon EMR Studio.
- `"Tags"`: A list of tags to associate with the Amazon EMR Studio. Tags are user-defined
  key-value pairs that consist of a required key string with a maximum of 128 characters, and
  an optional value string with a maximum of 256 characters.
"""
create_studio(AuthMode, DefaultS3Location, EngineSecurityGroupId, Name, ServiceRole, SubnetIds, UserRole, VpcId, WorkspaceSecurityGroupId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CreateStudio", Dict{String, Any}("AuthMode"=>AuthMode, "DefaultS3Location"=>DefaultS3Location, "EngineSecurityGroupId"=>EngineSecurityGroupId, "Name"=>Name, "ServiceRole"=>ServiceRole, "SubnetIds"=>SubnetIds, "UserRole"=>UserRole, "VpcId"=>VpcId, "WorkspaceSecurityGroupId"=>WorkspaceSecurityGroupId); aws_config=aws_config)
create_studio(AuthMode, DefaultS3Location, EngineSecurityGroupId, Name, ServiceRole, SubnetIds, UserRole, VpcId, WorkspaceSecurityGroupId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CreateStudio", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("AuthMode"=>AuthMode, "DefaultS3Location"=>DefaultS3Location, "EngineSecurityGroupId"=>EngineSecurityGroupId, "Name"=>Name, "ServiceRole"=>ServiceRole, "SubnetIds"=>SubnetIds, "UserRole"=>UserRole, "VpcId"=>VpcId, "WorkspaceSecurityGroupId"=>WorkspaceSecurityGroupId), params)); aws_config=aws_config)

"""
    create_studio_session_mapping(identity_type, session_policy_arn, studio_id)
    create_studio_session_mapping(identity_type, session_policy_arn, studio_id, params::Dict{String,<:Any})

Maps a user or group to the Amazon EMR Studio specified by StudioId, and applies a session
policy to refine Studio permissions for that user or group.

# Arguments
- `identity_type`: Specifies whether the identity to map to the Amazon EMR Studio is a user
  or a group.
- `session_policy_arn`: The Amazon Resource Name (ARN) for the session policy that will be
  applied to the user or group. Session policies refine Studio user permissions without the
  need to use multiple IAM user roles.
- `studio_id`: The ID of the Amazon EMR Studio to which the user or group will be mapped.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"IdentityId"`: The globally unique identifier (GUID) of the user or group from the AWS
  SSO Identity Store. For more information, see UserId and GroupId in the AWS SSO Identity
  Store API Reference. Either IdentityName or IdentityId must be specified.
- `"IdentityName"`: The name of the user or group. For more information, see UserName and
  DisplayName in the AWS SSO Identity Store API Reference. Either IdentityName or IdentityId
  must be specified.
"""
create_studio_session_mapping(IdentityType, SessionPolicyArn, StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CreateStudioSessionMapping", Dict{String, Any}("IdentityType"=>IdentityType, "SessionPolicyArn"=>SessionPolicyArn, "StudioId"=>StudioId); aws_config=aws_config)
create_studio_session_mapping(IdentityType, SessionPolicyArn, StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("CreateStudioSessionMapping", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("IdentityType"=>IdentityType, "SessionPolicyArn"=>SessionPolicyArn, "StudioId"=>StudioId), params)); aws_config=aws_config)

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

Deletes a security configuration.

# Arguments
- `name`: The name of the security configuration.

"""
delete_security_configuration(Name; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DeleteSecurityConfiguration", Dict{String, Any}("Name"=>Name); aws_config=aws_config)
delete_security_configuration(Name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DeleteSecurityConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Name"=>Name), params)); aws_config=aws_config)

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

Removes an Amazon EMR Studio from the Studio metadata store.

# Arguments
- `studio_id`: The ID of the Amazon EMR Studio.

"""
delete_studio(StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DeleteStudio", Dict{String, Any}("StudioId"=>StudioId); aws_config=aws_config)
delete_studio(StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DeleteStudio", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("StudioId"=>StudioId), params)); aws_config=aws_config)

"""
    delete_studio_session_mapping(identity_type, studio_id)
    delete_studio_session_mapping(identity_type, studio_id, params::Dict{String,<:Any})

Removes a user or group from an Amazon EMR Studio.

# Arguments
- `identity_type`: Specifies whether the identity to delete from the Amazon EMR Studio is a
  user or a group.
- `studio_id`: The ID of the Amazon EMR Studio.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"IdentityId"`: The globally unique identifier (GUID) of the user or group to remove from
  the Amazon EMR Studio. For more information, see UserId and GroupId in the AWS SSO Identity
  Store API Reference. Either IdentityName or IdentityId must be specified.
- `"IdentityName"`: The name of the user name or group to remove from the Amazon EMR
  Studio. For more information, see UserName and DisplayName in the AWS SSO Identity Store
  API Reference. Either IdentityName or IdentityId must be specified.
"""
delete_studio_session_mapping(IdentityType, StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DeleteStudioSessionMapping", Dict{String, Any}("IdentityType"=>IdentityType, "StudioId"=>StudioId); aws_config=aws_config)
delete_studio_session_mapping(IdentityType, StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DeleteStudioSessionMapping", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("IdentityType"=>IdentityType, "StudioId"=>StudioId), params)); aws_config=aws_config)

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

Provides cluster-level details including status, hardware and software configuration, VPC
settings, and so on.

# Arguments
- `cluster_id`: The identifier of the cluster to describe.

"""
describe_cluster(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeCluster", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
describe_cluster(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeCluster", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

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

This API is no longer supported and will eventually be removed. We recommend you use
ListClusters, DescribeCluster, ListSteps, ListInstanceGroups and ListBootstrapActions
instead. DescribeJobFlows returns a list of job flows that match all of the supplied
parameters. The parameters can include a list of job flow IDs, job flow states, and
restrictions on job flow creation date and time. Regardless of supplied parameters, only
job flows created within the last two months are returned. If no parameters are supplied,
then job flows matching either of the following criteria are returned:   Job flows created
and completed in the last two weeks    Job flows created within the last two months that
are in one of the following states: RUNNING, WAITING, SHUTTING_DOWN, STARTING    Amazon EMR
can return a maximum of 512 job flow descriptions.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"CreatedAfter"`: Return only job flows created after this date and time.
- `"CreatedBefore"`: Return only job flows created before this date and time.
- `"JobFlowIds"`: Return only job flows whose job flow ID is contained in this list.
- `"JobFlowStates"`: Return only job flows whose state is contained in this list.
"""
describe_job_flows(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeJobFlows"; aws_config=aws_config)
describe_job_flows(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeJobFlows", params; aws_config=aws_config)

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

Provides details of a notebook execution.

# Arguments
- `notebook_execution_id`: The unique identifier of the notebook execution.

"""
describe_notebook_execution(NotebookExecutionId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeNotebookExecution", Dict{String, Any}("NotebookExecutionId"=>NotebookExecutionId); aws_config=aws_config)
describe_notebook_execution(NotebookExecutionId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeNotebookExecution", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("NotebookExecutionId"=>NotebookExecutionId), params)); aws_config=aws_config)

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

Provides the details of a security configuration by returning the configuration JSON.

# Arguments
- `name`: The name of the security configuration.

"""
describe_security_configuration(Name; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeSecurityConfiguration", Dict{String, Any}("Name"=>Name); aws_config=aws_config)
describe_security_configuration(Name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeSecurityConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Name"=>Name), params)); aws_config=aws_config)

"""
    describe_step(cluster_id, step_id)
    describe_step(cluster_id, step_id, params::Dict{String,<:Any})

Provides more detail about the cluster step.

# Arguments
- `cluster_id`: The identifier of the cluster with steps to describe.
- `step_id`: The identifier of the step to describe.

"""
describe_step(ClusterId, StepId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeStep", Dict{String, Any}("ClusterId"=>ClusterId, "StepId"=>StepId); aws_config=aws_config)
describe_step(ClusterId, StepId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeStep", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId, "StepId"=>StepId), params)); aws_config=aws_config)

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

Returns details for the specified Amazon EMR Studio including ID, Name, VPC, Studio access
URL, and so on.

# Arguments
- `studio_id`: The Amazon EMR Studio ID.

"""
describe_studio(StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeStudio", Dict{String, Any}("StudioId"=>StudioId); aws_config=aws_config)
describe_studio(StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("DescribeStudio", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("StudioId"=>StudioId), params)); aws_config=aws_config)

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

Returns the Amazon EMR block public access configuration for your AWS account in the
current Region. For more information see Configure Block Public Access for Amazon EMR in
the Amazon EMR Management Guide.

"""
get_block_public_access_configuration(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("GetBlockPublicAccessConfiguration"; aws_config=aws_config)
get_block_public_access_configuration(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("GetBlockPublicAccessConfiguration", params; aws_config=aws_config)

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

Fetches the attached managed scaling policy for an Amazon EMR cluster.

# Arguments
- `cluster_id`: Specifies the ID of the cluster for which the managed scaling policy will
  be fetched.

"""
get_managed_scaling_policy(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("GetManagedScalingPolicy", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
get_managed_scaling_policy(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("GetManagedScalingPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

"""
    get_studio_session_mapping(identity_type, studio_id)
    get_studio_session_mapping(identity_type, studio_id, params::Dict{String,<:Any})

Fetches mapping details for the specified Amazon EMR Studio and identity (user or group).

# Arguments
- `identity_type`: Specifies whether the identity to fetch is a user or a group.
- `studio_id`: The ID of the Amazon EMR Studio.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"IdentityId"`: The globally unique identifier (GUID) of the user or group. For more
  information, see UserId and GroupId in the AWS SSO Identity Store API Reference. Either
  IdentityName or IdentityId must be specified.
- `"IdentityName"`: The name of the user or group to fetch. For more information, see
  UserName and DisplayName in the AWS SSO Identity Store API Reference. Either IdentityName
  or IdentityId must be specified.
"""
get_studio_session_mapping(IdentityType, StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("GetStudioSessionMapping", Dict{String, Any}("IdentityType"=>IdentityType, "StudioId"=>StudioId); aws_config=aws_config)
get_studio_session_mapping(IdentityType, StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("GetStudioSessionMapping", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("IdentityType"=>IdentityType, "StudioId"=>StudioId), params)); aws_config=aws_config)

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

Provides information about the bootstrap actions associated with a cluster.

# Arguments
- `cluster_id`: The cluster identifier for the bootstrap actions to list.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Marker"`: The pagination token that indicates the next set of results to retrieve.
"""
list_bootstrap_actions(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListBootstrapActions", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
list_bootstrap_actions(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListBootstrapActions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

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

Provides the status of all clusters visible to this AWS account. Allows you to filter the
list of clusters based on certain criteria; for example, filtering by cluster creation date
and time or by status. This call returns a maximum of 50 clusters per call, but returns a
marker to track the paging of the cluster list across multiple ListClusters calls.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClusterStates"`: The cluster state filters to apply when listing clusters.
- `"CreatedAfter"`: The creation date and time beginning value filter for listing clusters.
- `"CreatedBefore"`: The creation date and time end value filter for listing clusters.
- `"Marker"`: The pagination token that indicates the next set of results to retrieve.
"""
list_clusters(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListClusters"; aws_config=aws_config)
list_clusters(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListClusters", params; aws_config=aws_config)

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

Lists all available details about the instance fleets in a cluster.  The instance fleet
configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x
versions.

# Arguments
- `cluster_id`: The unique identifier of the cluster.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Marker"`: The pagination token that indicates the next set of results to retrieve.
"""
list_instance_fleets(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListInstanceFleets", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
list_instance_fleets(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListInstanceFleets", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

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

Provides all available details about the instance groups in a cluster.

# Arguments
- `cluster_id`: The identifier of the cluster for which to list the instance groups.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Marker"`: The pagination token that indicates the next set of results to retrieve.
"""
list_instance_groups(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListInstanceGroups", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
list_instance_groups(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListInstanceGroups", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

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

Provides information for all active EC2 instances and EC2 instances terminated in the last
30 days, up to a maximum of 2,000. EC2 instances in any of the following states are
considered active: AWAITING_FULFILLMENT, PROVISIONING, BOOTSTRAPPING, RUNNING.

# Arguments
- `cluster_id`: The identifier of the cluster for which to list the instances.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"InstanceFleetId"`: The unique identifier of the instance fleet.
- `"InstanceFleetType"`: The node type of the instance fleet. For example MASTER, CORE, or
  TASK.
- `"InstanceGroupId"`: The identifier of the instance group for which to list the instances.
- `"InstanceGroupTypes"`: The type of instance group for which to list the instances.
- `"InstanceStates"`: A list of instance states that will filter the instances returned
  with this request.
- `"Marker"`: The pagination token that indicates the next set of results to retrieve.
"""
list_instances(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListInstances", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
list_instances(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListInstances", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

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

Provides summaries of all notebook executions. You can filter the list based on multiple
criteria such as status, time range, and editor id. Returns a maximum of 50 notebook
executions and a marker to track the paging of a longer notebook execution list across
multiple ListNotebookExecution calls.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"EditorId"`: The unique ID of the editor associated with the notebook execution.
- `"From"`: The beginning of time range filter for listing notebook executions. The default
  is the timestamp of 30 days ago.
- `"Marker"`: The pagination token, returned by a previous ListNotebookExecutions call,
  that indicates the start of the list for this ListNotebookExecutions call.
- `"Status"`: The status filter for listing notebook executions.    START_PENDING indicates
  that the cluster has received the execution request but execution has not begun.
  STARTING indicates that the execution is starting on the cluster.    RUNNING indicates that
  the execution is being processed by the cluster.    FINISHING indicates that execution
  processing is in the final stages.    FINISHED indicates that the execution has completed
  without error.    FAILING indicates that the execution is failing and will not finish
  successfully.    FAILED indicates that the execution failed.    STOP_PENDING indicates that
  the cluster has received a StopNotebookExecution request and the stop is pending.
  STOPPING indicates that the cluster is in the process of stopping the execution as a result
  of a StopNotebookExecution request.    STOPPED indicates that the execution stopped because
  of a StopNotebookExecution request.
- `"To"`: The end of time range filter for listing notebook executions. The default is the
  current timestamp.
"""
list_notebook_executions(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListNotebookExecutions"; aws_config=aws_config)
list_notebook_executions(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListNotebookExecutions", params; aws_config=aws_config)

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

Lists all the security configurations visible to this account, providing their creation
dates and times, and their names. This call returns a maximum of 50 clusters per call, but
returns a marker to track the paging of the cluster list across multiple
ListSecurityConfigurations calls.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Marker"`: The pagination token that indicates the set of results to retrieve.
"""
list_security_configurations(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListSecurityConfigurations"; aws_config=aws_config)
list_security_configurations(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListSecurityConfigurations", params; aws_config=aws_config)

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

Provides a list of steps for the cluster in reverse order unless you specify stepIds with
the request of filter by StepStates. You can specify a maximum of 10 stepIDs.

# Arguments
- `cluster_id`: The identifier of the cluster for which to list the steps.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Marker"`: The pagination token that indicates the next set of results to retrieve.
- `"StepIds"`: The filter to limit the step list based on the identifier of the steps. You
  can specify a maximum of ten Step IDs. The character constraint applies to the overall
  length of the array.
- `"StepStates"`: The filter to limit the step list based on certain states.
"""
list_steps(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListSteps", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
list_steps(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListSteps", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

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

Returns a list of all user or group session mappings for the Amazon EMR Studio specified by
StudioId.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"IdentityType"`: Specifies whether to return session mappings for users or groups. If
  not specified, the results include session mapping details for both users and groups.
- `"Marker"`: The pagination token that indicates the set of results to retrieve.
- `"StudioId"`: The ID of the Amazon EMR Studio.
"""
list_studio_session_mappings(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListStudioSessionMappings"; aws_config=aws_config)
list_studio_session_mappings(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListStudioSessionMappings", params; aws_config=aws_config)

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

Returns a list of all Amazon EMR Studios associated with the AWS account. The list includes
details such as ID, Studio Access URL, and creation time for each Studio.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Marker"`: The pagination token that indicates the set of results to retrieve.
"""
list_studios(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListStudios"; aws_config=aws_config)
list_studios(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ListStudios", params; aws_config=aws_config)

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

Modifies the number of steps that can be executed concurrently for the cluster specified
using ClusterID.

# Arguments
- `cluster_id`: The unique identifier of the cluster.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"StepConcurrencyLevel"`: The number of steps that can be executed concurrently. You can
  specify a minimum of 1 step and a maximum of 256 steps.
"""
modify_cluster(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ModifyCluster", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
modify_cluster(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ModifyCluster", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

"""
    modify_instance_fleet(cluster_id, instance_fleet)
    modify_instance_fleet(cluster_id, instance_fleet, params::Dict{String,<:Any})

Modifies the target On-Demand and target Spot capacities for the instance fleet with the
specified InstanceFleetID within the cluster specified using ClusterID. The call either
succeeds or fails atomically.  The instance fleet configuration is available only in Amazon
EMR versions 4.8.0 and later, excluding 5.0.x versions.

# Arguments
- `cluster_id`: The unique identifier of the cluster.
- `instance_fleet`: The unique identifier of the instance fleet.

"""
modify_instance_fleet(ClusterId, InstanceFleet; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ModifyInstanceFleet", Dict{String, Any}("ClusterId"=>ClusterId, "InstanceFleet"=>InstanceFleet); aws_config=aws_config)
modify_instance_fleet(ClusterId, InstanceFleet, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ModifyInstanceFleet", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId, "InstanceFleet"=>InstanceFleet), params)); aws_config=aws_config)

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

ModifyInstanceGroups modifies the number of nodes and configuration settings of an instance
group. The input parameters include the new target instance count for the group and the
instance group ID. The call will either succeed or fail atomically.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"ClusterId"`: The ID of the cluster to which the instance group belongs.
- `"InstanceGroups"`: Instance groups to change.
"""
modify_instance_groups(; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ModifyInstanceGroups"; aws_config=aws_config)
modify_instance_groups(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("ModifyInstanceGroups", params; aws_config=aws_config)

"""
    put_auto_scaling_policy(auto_scaling_policy, cluster_id, instance_group_id)
    put_auto_scaling_policy(auto_scaling_policy, cluster_id, instance_group_id, params::Dict{String,<:Any})

Creates or updates an automatic scaling policy for a core instance group or task instance
group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group
dynamically adds and terminates EC2 instances in response to the value of a CloudWatch
metric.

# Arguments
- `auto_scaling_policy`: Specifies the definition of the automatic scaling policy.
- `cluster_id`: Specifies the ID of a cluster. The instance group to which the automatic
  scaling policy is applied is within this cluster.
- `instance_group_id`: Specifies the ID of the instance group to which the automatic
  scaling policy is applied.

"""
put_auto_scaling_policy(AutoScalingPolicy, ClusterId, InstanceGroupId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("PutAutoScalingPolicy", Dict{String, Any}("AutoScalingPolicy"=>AutoScalingPolicy, "ClusterId"=>ClusterId, "InstanceGroupId"=>InstanceGroupId); aws_config=aws_config)
put_auto_scaling_policy(AutoScalingPolicy, ClusterId, InstanceGroupId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("PutAutoScalingPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("AutoScalingPolicy"=>AutoScalingPolicy, "ClusterId"=>ClusterId, "InstanceGroupId"=>InstanceGroupId), params)); aws_config=aws_config)

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

Creates or updates an Amazon EMR block public access configuration for your AWS account in
the current Region. For more information see Configure Block Public Access for Amazon EMR
in the Amazon EMR Management Guide.

# Arguments
- `block_public_access_configuration`: A configuration for Amazon EMR block public access.
  The configuration applies to all clusters created in your account for the current Region.
  The configuration specifies whether block public access is enabled. If block public access
  is enabled, security groups associated with the cluster cannot have rules that allow
  inbound traffic from 0.0.0.0/0 or ::/0 on a port, unless the port is specified as an
  exception using PermittedPublicSecurityGroupRuleRanges in the
  BlockPublicAccessConfiguration. By default, Port 22 (SSH) is an exception, and public
  access is allowed on this port. You can change this by updating
  BlockPublicSecurityGroupRules to remove the exception.  For accounts that created clusters
  in a Region before November 25, 2019, block public access is disabled by default in that
  Region. To use this feature, you must manually enable and configure it. For accounts that
  did not create an EMR cluster in a Region before this date, block public access is enabled
  by default in that Region.

"""
put_block_public_access_configuration(BlockPublicAccessConfiguration; aws_config::AbstractAWSConfig=global_aws_config()) = emr("PutBlockPublicAccessConfiguration", Dict{String, Any}("BlockPublicAccessConfiguration"=>BlockPublicAccessConfiguration); aws_config=aws_config)
put_block_public_access_configuration(BlockPublicAccessConfiguration, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("PutBlockPublicAccessConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("BlockPublicAccessConfiguration"=>BlockPublicAccessConfiguration), params)); aws_config=aws_config)

"""
    put_managed_scaling_policy(cluster_id, managed_scaling_policy)
    put_managed_scaling_policy(cluster_id, managed_scaling_policy, params::Dict{String,<:Any})

Creates or updates a managed scaling policy for an Amazon EMR cluster. The managed scaling
policy defines the limits for resources, such as EC2 instances that can be added or
terminated from a cluster. The policy only applies to the core and task nodes. The master
node cannot be scaled after initial configuration.

# Arguments
- `cluster_id`: Specifies the ID of an EMR cluster where the managed scaling policy is
  attached.
- `managed_scaling_policy`: Specifies the constraints for the managed scaling policy.

"""
put_managed_scaling_policy(ClusterId, ManagedScalingPolicy; aws_config::AbstractAWSConfig=global_aws_config()) = emr("PutManagedScalingPolicy", Dict{String, Any}("ClusterId"=>ClusterId, "ManagedScalingPolicy"=>ManagedScalingPolicy); aws_config=aws_config)
put_managed_scaling_policy(ClusterId, ManagedScalingPolicy, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("PutManagedScalingPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId, "ManagedScalingPolicy"=>ManagedScalingPolicy), params)); aws_config=aws_config)

"""
    remove_auto_scaling_policy(cluster_id, instance_group_id)
    remove_auto_scaling_policy(cluster_id, instance_group_id, params::Dict{String,<:Any})

Removes an automatic scaling policy from a specified instance group within an EMR cluster.

# Arguments
- `cluster_id`: Specifies the ID of a cluster. The instance group to which the automatic
  scaling policy is applied is within this cluster.
- `instance_group_id`: Specifies the ID of the instance group to which the scaling policy
  is applied.

"""
remove_auto_scaling_policy(ClusterId, InstanceGroupId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RemoveAutoScalingPolicy", Dict{String, Any}("ClusterId"=>ClusterId, "InstanceGroupId"=>InstanceGroupId); aws_config=aws_config)
remove_auto_scaling_policy(ClusterId, InstanceGroupId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RemoveAutoScalingPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId, "InstanceGroupId"=>InstanceGroupId), params)); aws_config=aws_config)

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

 Removes a managed scaling policy from a specified EMR cluster.

# Arguments
- `cluster_id`:  Specifies the ID of the cluster from which the managed scaling policy will
  be removed.

"""
remove_managed_scaling_policy(ClusterId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RemoveManagedScalingPolicy", Dict{String, Any}("ClusterId"=>ClusterId); aws_config=aws_config)
remove_managed_scaling_policy(ClusterId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RemoveManagedScalingPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClusterId"=>ClusterId), params)); aws_config=aws_config)

"""
    remove_tags(resource_id, tag_keys)
    remove_tags(resource_id, tag_keys, params::Dict{String,<:Any})

Removes tags from an Amazon EMR resource. Tags make it easier to associate clusters in
various ways, such as grouping clusters to track your Amazon EMR resource allocation costs.
For more information, see Tag Clusters.  The following example removes the stack tag with
value Prod from a cluster:

# Arguments
- `resource_id`: The Amazon EMR resource identifier from which tags will be removed. This
  value must be a cluster identifier.
- `tag_keys`: A list of tag keys to remove from a resource.

"""
remove_tags(ResourceId, TagKeys; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RemoveTags", Dict{String, Any}("ResourceId"=>ResourceId, "TagKeys"=>TagKeys); aws_config=aws_config)
remove_tags(ResourceId, TagKeys, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RemoveTags", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ResourceId"=>ResourceId, "TagKeys"=>TagKeys), params)); aws_config=aws_config)

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

RunJobFlow creates and starts running a new cluster (job flow). The cluster runs the steps
specified. After the steps complete, the cluster stops and the HDFS partition is lost. To
prevent loss of data, configure the last step of the job flow to store results in Amazon
S3. If the JobFlowInstancesConfig KeepJobFlowAliveWhenNoSteps parameter is set to TRUE, the
cluster transitions to the WAITING state rather than shutting down after the steps have
completed.  For additional protection, you can set the JobFlowInstancesConfig
TerminationProtected parameter to TRUE to lock the cluster and prevent it from being
terminated by API call, user intervention, or in the event of a job flow error. A maximum
of 256 steps are allowed in each job flow. If your cluster is long-running (such as a Hive
data warehouse) or complex, you may require more than 256 steps to process your data. You
can bypass the 256-step limitation in various ways, including using the SSH shell to
connect to the master node and submitting queries directly to the software running on the
master node, such as Hive and Hadoop. For more information on how to do this, see Add More
than 256 Steps to a Cluster in the Amazon EMR Management Guide. For long running clusters,
we recommend that you periodically store your results.  The instance fleets configuration
is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions. The
RunJobFlow request can contain InstanceFleets parameters or InstanceGroups parameters, but
not both.

# Arguments
- `instances`: A specification of the number and type of Amazon EC2 instances.
- `name`: The name of the job flow.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"AdditionalInfo"`: A JSON string for selecting additional features.
- `"AmiVersion"`: Applies only to Amazon EMR AMI versions 3.x and 2.x. For Amazon EMR
  releases 4.0 and later, ReleaseLabel is used. To specify a custom AMI, use CustomAmiID.
- `"Applications"`: Applies to Amazon EMR releases 4.0 and later. A case-insensitive list
  of applications for Amazon EMR to install and configure when launching the cluster. For a
  list of applications available for each Amazon EMR release version, see the Amazon EMR
  Release Guide.
- `"AutoScalingRole"`: An IAM role for automatic scaling policies. The default role is
  EMR_AutoScaling_DefaultRole. The IAM role provides permissions that the automatic scaling
  feature requires to launch and terminate EC2 instances in an instance group.
- `"BootstrapActions"`: A list of bootstrap actions to run before Hadoop starts on the
  cluster nodes.
- `"Configurations"`: For Amazon EMR releases 4.0 and later. The list of configurations
  supplied for the EMR cluster you are creating.
- `"CustomAmiId"`: Available only in Amazon EMR version 5.7.0 and later. The ID of a custom
  Amazon EBS-backed Linux AMI. If specified, Amazon EMR uses this AMI when it launches
  cluster EC2 instances. For more information about custom AMIs in Amazon EMR, see Using a
  Custom AMI in the Amazon EMR Management Guide. If omitted, the cluster uses the base Linux
  AMI for the ReleaseLabel specified. For Amazon EMR versions 2.x and 3.x, use AmiVersion
  instead. For information about creating a custom AMI, see Creating an Amazon EBS-Backed
  Linux AMI in the Amazon Elastic Compute Cloud User Guide for Linux Instances. For
  information about finding an AMI ID, see Finding a Linux AMI.
- `"EbsRootVolumeSize"`: The size, in GiB, of the Amazon EBS root device volume of the
  Linux AMI that is used for each EC2 instance. Available in Amazon EMR version 4.x and later.
- `"JobFlowRole"`: Also called instance profile and EC2 role. An IAM role for an EMR
  cluster. The EC2 instances of the cluster assume this role. The default role is
  EMR_EC2_DefaultRole. In order to use the default role, you must have already created it
  using the CLI or console.
- `"KerberosAttributes"`: Attributes for Kerberos configuration when Kerberos
  authentication is enabled using a security configuration. For more information see Use
  Kerberos Authentication in the Amazon EMR Management Guide.
- `"LogEncryptionKmsKeyId"`: The AWS KMS customer master key (CMK) used for encrypting log
  files. If a value is not provided, the logs remain encrypted by AES-256. This attribute is
  only available with Amazon EMR version 5.30.0 and later, excluding Amazon EMR 6.0.0.
- `"LogUri"`: The location in Amazon S3 to write the log files of the job flow. If a value
  is not provided, logs are not created.
- `"ManagedScalingPolicy"`:  The specified managed scaling policy for an Amazon EMR
  cluster.
- `"NewSupportedProducts"`:  For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases
  4.x and later, use Applications.  A list of strings that indicates third-party software to
  use with the job flow that accepts a user argument list. EMR accepts and forwards the
  argument list to the corresponding installation script as bootstrap action arguments. For
  more information, see \"Launch a Job Flow on the MapR Distribution for Hadoop\" in the
  Amazon EMR Developer Guide. Supported values are:   \"mapr-m3\" - launch the cluster using
  MapR M3 Edition.   \"mapr-m5\" - launch the cluster using MapR M5 Edition.   \"mapr\" with
  the user arguments specifying \"--edition,m3\" or \"--edition,m5\" - launch the job flow
  using MapR M3 or M5 Edition respectively.   \"mapr-m7\" - launch the cluster using MapR M7
  Edition.   \"hunk\" - launch the cluster with the Hunk Big Data Analytics Platform.
  \"hue\"- launch the cluster with Hue installed.   \"spark\" - launch the cluster with
  Apache Spark installed.   \"ganglia\" - launch the cluster with the Ganglia Monitoring
  System installed.
- `"PlacementGroupConfigs"`: The specified placement group configuration for an Amazon EMR
  cluster.
- `"ReleaseLabel"`: The Amazon EMR release label, which determines the version of
  open-source application packages installed on the cluster. Release labels are in the form
  emr-x.x.x, where x.x.x is an Amazon EMR release version such as emr-5.14.0. For more
  information about Amazon EMR release versions and included application versions and
  features, see https://docs.aws.amazon.com/emr/latest/ReleaseGuide/. The release label
  applies only to Amazon EMR releases version 4.0 and later. Earlier versions use AmiVersion.
- `"RepoUpgradeOnBoot"`: Applies only when CustomAmiID is used. Specifies which updates
  from the Amazon Linux AMI package repositories to apply automatically when the instance
  boots using the AMI. If omitted, the default is SECURITY, which indicates that only
  security updates are applied. If NONE is specified, no updates are applied, and all updates
  must be applied manually.
- `"ScaleDownBehavior"`: Specifies the way that individual Amazon EC2 instances terminate
  when an automatic scale-in activity occurs or an instance group is resized.
  TERMINATE_AT_INSTANCE_HOUR indicates that Amazon EMR terminates nodes at the instance-hour
  boundary, regardless of when the request to terminate the instance was submitted. This
  option is only available with Amazon EMR 5.1.0 and later and is the default for clusters
  created using that version. TERMINATE_AT_TASK_COMPLETION indicates that Amazon EMR adds
  nodes to a deny list and drains tasks from nodes before terminating the Amazon EC2
  instances, regardless of the instance-hour boundary. With either behavior, Amazon EMR
  removes the least active nodes first and blocks instance termination if it could lead to
  HDFS corruption. TERMINATE_AT_TASK_COMPLETION available only in Amazon EMR version 4.1.0
  and later, and is the default for versions of Amazon EMR earlier than 5.1.0.
- `"SecurityConfiguration"`: The name of a security configuration to apply to the cluster.
- `"ServiceRole"`: The IAM role that will be assumed by the Amazon EMR service to access
  AWS resources on your behalf.
- `"StepConcurrencyLevel"`: Specifies the number of steps that can be executed
  concurrently. The default value is 1. The maximum value is 256.
- `"Steps"`: A list of steps to run.
- `"SupportedProducts"`:  For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x
  and later, use Applications.  A list of strings that indicates third-party software to use.
  For more information, see the Amazon EMR Developer Guide. Currently supported values are:
  \"mapr-m3\" - launch the job flow using MapR M3 Edition.   \"mapr-m5\" - launch the job
  flow using MapR M5 Edition.
- `"Tags"`: A list of tags to associate with a cluster and propagate to Amazon EC2
  instances.
- `"VisibleToAllUsers"`: A value of true indicates that all IAM users in the AWS account
  can perform cluster actions if they have the proper IAM policy permissions. This is the
  default. A value of false indicates that only the IAM user who created the cluster can
  perform actions.
"""
run_job_flow(Instances, Name; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RunJobFlow", Dict{String, Any}("Instances"=>Instances, "Name"=>Name); aws_config=aws_config)
run_job_flow(Instances, Name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("RunJobFlow", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Instances"=>Instances, "Name"=>Name), params)); aws_config=aws_config)

"""
    set_termination_protection(job_flow_ids, termination_protected)
    set_termination_protection(job_flow_ids, termination_protected, params::Dict{String,<:Any})

SetTerminationProtection locks a cluster (job flow) so the EC2 instances in the cluster
cannot be terminated by user intervention, an API call, or in the event of a job-flow
error. The cluster still terminates upon successful completion of the job flow. Calling
SetTerminationProtection on a cluster is similar to calling the Amazon EC2
DisableAPITermination API on all EC2 instances in a cluster.  SetTerminationProtection is
used to prevent accidental termination of a cluster and to ensure that in the event of an
error, the instances persist so that you can recover any data stored in their ephemeral
instance storage.  To terminate a cluster that has been locked by setting
SetTerminationProtection to true, you must first unlock the job flow by a subsequent call
to SetTerminationProtection in which you set the value to false.   For more information,
seeManaging Cluster Termination in the Amazon EMR Management Guide.

# Arguments
- `job_flow_ids`:  A list of strings that uniquely identify the clusters to protect. This
  identifier is returned by RunJobFlow and can also be obtained from DescribeJobFlows .
- `termination_protected`: A Boolean that indicates whether to protect the cluster and
  prevent the Amazon EC2 instances in the cluster from shutting down due to API calls, user
  intervention, or job-flow error.

"""
set_termination_protection(JobFlowIds, TerminationProtected; aws_config::AbstractAWSConfig=global_aws_config()) = emr("SetTerminationProtection", Dict{String, Any}("JobFlowIds"=>JobFlowIds, "TerminationProtected"=>TerminationProtected); aws_config=aws_config)
set_termination_protection(JobFlowIds, TerminationProtected, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("SetTerminationProtection", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("JobFlowIds"=>JobFlowIds, "TerminationProtected"=>TerminationProtected), params)); aws_config=aws_config)

"""
    set_visible_to_all_users(job_flow_ids, visible_to_all_users)
    set_visible_to_all_users(job_flow_ids, visible_to_all_users, params::Dict{String,<:Any})

Sets the ClusterVisibleToAllUsers value, which determines whether the cluster is visible to
all IAM users of the AWS account associated with the cluster. Only the IAM user who created
the cluster or the AWS account root user can call this action. The default value, true,
indicates that all IAM users in the AWS account can perform cluster actions if they have
the proper IAM policy permissions. If set to false, only the IAM user that created the
cluster can perform actions. This action works on running clusters. You can override the
default true setting when you create a cluster by using the VisibleToAllUsers parameter
with RunJobFlow.

# Arguments
- `job_flow_ids`: The unique identifier of the job flow (cluster).
- `visible_to_all_users`: A value of true indicates that all IAM users in the AWS account
  can perform cluster actions if they have the proper IAM policy permissions. This is the
  default. A value of false indicates that only the IAM user who created the cluster can
  perform actions.

"""
set_visible_to_all_users(JobFlowIds, VisibleToAllUsers; aws_config::AbstractAWSConfig=global_aws_config()) = emr("SetVisibleToAllUsers", Dict{String, Any}("JobFlowIds"=>JobFlowIds, "VisibleToAllUsers"=>VisibleToAllUsers); aws_config=aws_config)
set_visible_to_all_users(JobFlowIds, VisibleToAllUsers, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("SetVisibleToAllUsers", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("JobFlowIds"=>JobFlowIds, "VisibleToAllUsers"=>VisibleToAllUsers), params)); aws_config=aws_config)

"""
    start_notebook_execution(editor_id, execution_engine, relative_path, service_role)
    start_notebook_execution(editor_id, execution_engine, relative_path, service_role, params::Dict{String,<:Any})

Starts a notebook execution.

# Arguments
- `editor_id`: The unique identifier of the EMR Notebook to use for notebook execution.
- `execution_engine`: Specifies the execution engine (cluster) that runs the notebook
  execution.
- `relative_path`: The path and file name of the notebook file for this execution, relative
  to the path specified for the EMR Notebook. For example, if you specify a path of
  s3://MyBucket/MyNotebooks when you create an EMR Notebook for a notebook with an ID of
  e-ABCDEFGHIJK1234567890ABCD (the EditorID of this request), and you specify a RelativePath
  of my_notebook_executions/notebook_execution.ipynb, the location of the file for the
  notebook execution is
  s3://MyBucket/MyNotebooks/e-ABCDEFGHIJK1234567890ABCD/my_notebook_executions/notebook_execut
  ion.ipynb.
- `service_role`: The name or ARN of the IAM role that is used as the service role for
  Amazon EMR (the EMR role) for the notebook execution.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"NotebookExecutionName"`: An optional name for the notebook execution.
- `"NotebookInstanceSecurityGroupId"`: The unique identifier of the Amazon EC2 security
  group to associate with the EMR Notebook for this notebook execution.
- `"NotebookParams"`: Input parameters in JSON format passed to the EMR Notebook at runtime
  for execution.
- `"Tags"`: A list of tags associated with a notebook execution. Tags are user-defined
  key-value pairs that consist of a required key string with a maximum of 128 characters and
  an optional value string with a maximum of 256 characters.
"""
start_notebook_execution(EditorId, ExecutionEngine, RelativePath, ServiceRole; aws_config::AbstractAWSConfig=global_aws_config()) = emr("StartNotebookExecution", Dict{String, Any}("EditorId"=>EditorId, "ExecutionEngine"=>ExecutionEngine, "RelativePath"=>RelativePath, "ServiceRole"=>ServiceRole); aws_config=aws_config)
start_notebook_execution(EditorId, ExecutionEngine, RelativePath, ServiceRole, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("StartNotebookExecution", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("EditorId"=>EditorId, "ExecutionEngine"=>ExecutionEngine, "RelativePath"=>RelativePath, "ServiceRole"=>ServiceRole), params)); aws_config=aws_config)

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

Stops a notebook execution.

# Arguments
- `notebook_execution_id`: The unique identifier of the notebook execution.

"""
stop_notebook_execution(NotebookExecutionId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("StopNotebookExecution", Dict{String, Any}("NotebookExecutionId"=>NotebookExecutionId); aws_config=aws_config)
stop_notebook_execution(NotebookExecutionId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("StopNotebookExecution", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("NotebookExecutionId"=>NotebookExecutionId), params)); aws_config=aws_config)

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

TerminateJobFlows shuts a list of clusters (job flows) down. When a job flow is shut down,
any step not yet completed is canceled and the EC2 instances on which the cluster is
running are stopped. Any log files not already saved are uploaded to Amazon S3 if a LogUri
was specified when the cluster was created. The maximum number of clusters allowed is 10.
The call to TerminateJobFlows is asynchronous. Depending on the configuration of the
cluster, it may take up to 1-5 minutes for the cluster to completely terminate and release
allocated resources, such as Amazon EC2 instances.

# Arguments
- `job_flow_ids`: A list of job flows to be shut down.

"""
terminate_job_flows(JobFlowIds; aws_config::AbstractAWSConfig=global_aws_config()) = emr("TerminateJobFlows", Dict{String, Any}("JobFlowIds"=>JobFlowIds); aws_config=aws_config)
terminate_job_flows(JobFlowIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("TerminateJobFlows", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("JobFlowIds"=>JobFlowIds), params)); aws_config=aws_config)

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

Updates an Amazon EMR Studio configuration, including attributes such as name, description,
and subnets.

# Arguments
- `studio_id`: The ID of the Amazon EMR Studio to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"DefaultS3Location"`: The Amazon S3 location to back up Workspaces and notebook files
  for the Amazon EMR Studio.
- `"Description"`: A detailed description to assign to the Amazon EMR Studio.
- `"Name"`: A descriptive name for the Amazon EMR Studio.
- `"SubnetIds"`: A list of subnet IDs to associate with the Amazon EMR Studio. The list can
  include new subnet IDs, but must also include all of the subnet IDs previously associated
  with the Studio. The list order does not matter. A Studio can have a maximum of 5 subnets.
  The subnets must belong to the same VPC as the Studio.
"""
update_studio(StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("UpdateStudio", Dict{String, Any}("StudioId"=>StudioId); aws_config=aws_config)
update_studio(StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("UpdateStudio", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("StudioId"=>StudioId), params)); aws_config=aws_config)

"""
    update_studio_session_mapping(identity_type, session_policy_arn, studio_id)
    update_studio_session_mapping(identity_type, session_policy_arn, studio_id, params::Dict{String,<:Any})

Updates the session policy attached to the user or group for the specified Amazon EMR
Studio.

# Arguments
- `identity_type`: Specifies whether the identity to update is a user or a group.
- `session_policy_arn`: The Amazon Resource Name (ARN) of the session policy to associate
  with the specified user or group.
- `studio_id`: The ID of the Amazon EMR Studio.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"IdentityId"`: The globally unique identifier (GUID) of the user or group. For more
  information, see UserId and GroupId in the AWS SSO Identity Store API Reference. Either
  IdentityName or IdentityId must be specified.
- `"IdentityName"`: The name of the user or group to update. For more information, see
  UserName and DisplayName in the AWS SSO Identity Store API Reference. Either IdentityName
  or IdentityId must be specified.
"""
update_studio_session_mapping(IdentityType, SessionPolicyArn, StudioId; aws_config::AbstractAWSConfig=global_aws_config()) = emr("UpdateStudioSessionMapping", Dict{String, Any}("IdentityType"=>IdentityType, "SessionPolicyArn"=>SessionPolicyArn, "StudioId"=>StudioId); aws_config=aws_config)
update_studio_session_mapping(IdentityType, SessionPolicyArn, StudioId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = emr("UpdateStudioSessionMapping", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("IdentityType"=>IdentityType, "SessionPolicyArn"=>SessionPolicyArn, "StudioId"=>StudioId), params)); aws_config=aws_config)


text:
using Test

@testset "Registrator" begin

include("server.jl")
include("regedit.jl")

end

ext: jl


text:
using Jive
using Documenter

makedocs(
    build = joinpath(@__DIR__, "local" in ARGS ? "build_local" : "build"),
    modules = [Jive],
    clean = false,
    format = Documenter.HTML(
        prettyurls = !("local" in ARGS),
        assets = ["assets/custom.css"],
    ),
    sitename = "Jive.jl 👣",
    authors = "WooKyoung Noh",
    pages = Any[
        "Home" => "index.md",
        "runtests" => "runtests.md",
        "watch" => "watch.md",
        "@skip" => "skip.md",
        "@onlyonce" => "onlyonce.md",
        "@If" => "If.md",
        "@useinside" => "useinside.md",
        "`@__END__`" => "END.md",
        "`@__REPL__`" => "REPL.md",
    ],
)


text:
module RTMIDI # PushInterface

include("../deps/deps.jl")

const RtMidiCCallback = Ptr{Cvoid}
struct RtMidiInData
    c_callback::RtMidiCCallback
    user_data::Ptr{Cvoid}
end

struct RtMidiWrapper
    ptr::Ptr{Cvoid}
    data::Ptr{RtMidiInData}
    ok::Bool
    msg::Cstring
end
const RtMidiPtr = Ref{RtMidiWrapper}

function rtmidi_sizeof_rtmidi_api()::Int
    Int(ccall((:rtmidi_sizeof_rtmidi_api, librtmidi), Cint, ()))
end

function rtmidi_get_port_count(device::RtMidiPtr)::Int
    Int(ccall((:rtmidi_get_port_count, librtmidi), Cuint, (Ptr{Cvoid},), device))
end

function rtmidi_get_port_name(device::RtMidiPtr, portNumber)::String
    unsafe_string(ccall((:rtmidi_get_port_name, librtmidi), Cstring, (Ptr{Cvoid}, Cuint), device, Cuint(portNumber)))
end

function rtmidi_open_port(device::RtMidiPtr, portNumber, portName)
    ccall((:rtmidi_open_port, librtmidi), Cvoid, (RtMidiPtr, Cuint, Cstring), device, portNumber, portName)
end

function destroy(device::RtMidiPtr)
   ccall((:rtmidi_close_port, librtmidi), Cvoid, (RtMidiPtr,), device)
end

### in

function rtmidi_in_create_default()::RtMidiPtr
    ccall((:rtmidi_in_create_default, librtmidi), RtMidiPtr, ())
end

function rtmidi_in_get_message(device::RtMidiPtr, message, size)
    ccall((:rtmidi_in_get_message, librtmidi), Cdouble, (RtMidiPtr, Ptr{Cstring}, Ptr{Csize_t}), device, message, size)
end

function rtmidi_in_set_callback(device::RtMidiPtr, callback, data)
    ccall((:rtmidi_in_set_callback, librtmidi), Cvoid, (RtMidiPtr, Ptr{Cvoid}, Ptr{Cvoid}), device, callback, data)
end

function rtmidi_in_cancel_callback(device::RtMidiPtr)
    ccall((:rtmidi_in_cancel_callback, librtmidi), Cvoid, (RtMidiPtr,), device)
end

struct EventCB
    handle::Ptr{Cvoid}
    timeStamp::Cdouble
    message::Ptr{Cuchar}
end

function rtmidi_callback_func(timeStamp::Cdouble, message::Ptr{Cuchar}, ptr::Ptr{EventCB})::Cvoid
    handle = unsafe_load(ptr, 1).handle
    val = EventCB(handle, timeStamp, message)
    unsafe_store!(ptr, val, 1)
    ccall(:uv_async_send, Cvoid, (Ptr{Cvoid},), handle)
    nothing
end

### out

function rtmidi_out_create_default()::RtMidiPtr
    ccall((:rtmidi_out_create_default, librtmidi), RtMidiPtr, ())
end

function rtmidi_out_send_message(device::RtMidiPtr, message, length)
    ccall((:rtmidi_out_send_message, librtmidi), Cint, (RtMidiPtr, Ptr{Cuchar}, Cint), device, message, length)
end

end # module PushInterface.RTMIDI


text:
#=
void acb_hypgeom_u(acb_t res, const acb_t a, const acb_t b, const acb_t z, slong prec)¶
Computes U(a,b,z) using an automatic algorithm choice.

void acb_hypgeom_0f1(acb_t res, const acb_t a, const acb_t z, int regularized, slong prec)¶
Computes the confluent hypergeometric function 0F1(a,z), or inv(Γ(a))0F1(a,z) if regularized is set,

void acb_hypgeom_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec)¶
Computes the confluent hypergeometric function M(a,b,z)=1F1(a,b,z), or M(a,b,z)=inv(Γ(b))1F1(a,b,z) if regularized is set.

acb_hypgeom_2f1(acb_t res, const acb_t a, const acb_t b,
        const acb_t c, const acb_t z, int flags, slong prec)
=#

"""
    hypergeometric_0F1(a, z)

confluent hypergeometric function ``₀F₁``
"""
function hypergeometric_0F1(a::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbComplex{P}()
    regularized = Cint(0)
    ccall(@libarb(acb_hypgeom_0f1), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Cint, Clong),
         result, a, z, regularized, P)
    return result
end

const F₀₁ = hypergeometric_0F1

"""
    regular_hypergeometric_0F1(a, z)

regularized confluent hypergeometric function, ``₀F₁ / gamma(a)``
"""
function regular_hypergeometric_0F1(a::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbComplex{P}()
    regularized = Cint(1)
    ccall(@libarb(acb_hypgeom_0f1), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Cint, Clong),
         result, a, z, regularized, P)
    return result
end

const regularF₀₁ = regular_hypergeometric_0F1

"""
    hypergeometric_U(a, b, z)

confluent hypergeometric function of the second kind
"""
function hypergeometric_U(a::ArbComplex{P}, b::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbReal{P}()
    ccall(@libarb(acb_hypgeom_u), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Clong),
         result, a, b, z, P)
    return result
end

"""
    hypergeometric_1F1(a, b, z)

confluent hypergeometric function ``₁F₁``
"""
function hypergeometric_1F1(a::ArbComplex{P}, b::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbComplex{P}()
    regularized = Cint(0)
    ccall(@libarb(acb_hypgeom_1f1), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Cint, Clong),
         result, a, b, z, regularized, P)
    return result
end

const F₁₁ = hypergeometric_1F1

"""
    regular_hypergeometric_1F1(a, b, z)

regularized confluent hypergeometric function, ``₁F₁ / gamma(a)``
"""
function regular_hypergeometric_1F1(a::ArbComplex{P}, b::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbComplex{P}()
    regularized = Cint(1)
    ccall(@libarb(acb_hypgeom_1f1), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Cint, Clong),
         result, a, b, z, regularized, P)
    return result
end

const regularF₁₁ = regular_hypergeometric_1F1

"""
    hypergeometric_2F1(a, b, c, z)

confluent hypergeometric function ``₂F₁``
"""
function hypergeometric_2F1(a::ArbComplex{P}, b::ArbComplex{P}, c::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbComplex{P}()
    regularized = Cint(0)
    ccall(@libarb(acb_hypgeom_2f1), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Cint, Clong),
         result, a, b, c, z, regularized, P)
    return result
end

const F₂₁ = hypergeometric_2F1

"""
    regular_hypergeometric_2F1_regularized(a, b, c, z)

regularized confluent hypergeometric function, ``₂F₁ / gamma(a)``
"""
function regular_hypergeometric_2F1(a::ArbComplex{P}, b::ArbComplex{P}, c::ArbComplex{P}, z::ArbComplex{P}) where {P}
    result = ArbComplex{P}()
    regularized = Cint(1)
    ccall(@libarb(acb_hypgeom_2f1), Cvoid, (Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Ref{ArbComplex}, Cint, Clong),
         result, a, b, c, z, regularized, P)
    return result
end

const regularF₂₁ = regular_hypergeometric_2F1

function hypergeometric_0F1(a::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    regularized = Cint(0)
    ccall(@libarb(arb_hypgeom_0f1), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Cint, Clong),
         result, a, z, regularized, P)
    return result
end

function regular_hypergeometric_0F1(a::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    regularized = Cint(1)
    ccall(@libarb(arb_hypgeom_0f1), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Cint, Clong),
         result, a, z, regularized, P)
    return result
end

function hypergeometric_U(a::ArbReal{P}, b::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    ccall(@libarb(arb_hypgeom_u), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Clong),
         result, a, b, z, P)
    return result
end

function hypergeometric_1F1(a::ArbReal{P}, b::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    regularized = Cint(0)
    ccall(@libarb(arb_hypgeom_1f1), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Cint, Clong),
         result, a, b, z, regularized, P)
    return result
end

function regular_hypergeometric_1F1(a::ArbReal{P}, b::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    regularized = Cint(1)
    ccall(@libarb(arb_hypgeom_1f1), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Cint, Clong),
         result, a, b, z, regularized, P)
    return result
end

function hypergeometric_2F1(a::ArbReal{P}, b::ArbReal{P}, c::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    regularized = Cint(0)
    ccall(@libarb(arb_hypgeom_2f1), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Cint, Clong),
         result, a, b, c, z, regularized, P)
    return result
end

function regular_hypergeometric_2F1(a::ArbReal{P}, b::ArbReal{P}, c::ArbReal{P}, z::ArbReal{P}) where {P}
    result = ArbReal{P}()
    regularized = Cint(1)
    ccall(@libarb(arb_hypgeom_2f1), Cvoid, (Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Ref{ArbReal}, Cint, Clong),
         result, a, b, c, z, regularized, P)
    return result
end

# ArbFloat

hypergeometric_0F1(a::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeom0f1(ArbReal{P}(a), ArbReal{P}(z)))

hypergeometric_0F1_regularized(a::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeom0f1reg(ArbReal{P}(a), ArbReal{P}(z)))

hypergeometric_U(a::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeomu(ArbReal{P}(a), ArbReal{P}(z)))

hypergeometric_1F1(a::ArbFloat{P}, b::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeom1f1(ArbReal{P}(a), ArbReal{P}(b), ArbReal{P}(z)))

hypergeometric_1F1_regularized(a::ArbFloat{P}, b::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeom1f1reg(ArbReal{P}(a), ArbReal{P}(b), ArbReal{P}(z)))

hypergeometric_1F2(a::ArbFloat{P}, b::ArbFloat{P}, c::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeom1f2(ArbReal{P}(a), ArbReal{P}(b), ArbReal{P}(c), ArbReal{P}(z)))

hypergeometric_1F2_regularized(a::ArbFloat{P}, b::ArbFloat{P}, c::ArbFloat{P}, z::ArbFloat{P}) where {P} =
    ArbFloat{P}(hypgeom1f2reg(ArbReal{P}(a), ArbReal{P}(b), ArbReal{P}(c), ArbReal{P}(z)))


text:
export
    # Fock basis
    FockState,
    NumberState,
    VacuumState,
    SinglePhotonState,

    # pure state
    CoherentState,
    SqueezedState,

    # mixed state
    ThermalState,
    SqueezedThermalState

################
# constructors #
################

##### Fock basis #####

"""
    FockState([T::Type{<:Number}], n::Integer, [rep::Type]; dim::Integer)

Construct a Fock state in `rep` representation.

## Arguments

* `T`: Numerical type. Default as `Float64` if not assigned.
* `n`: Photon number of Fock state.
* `rep`: In which representation, default as `Vector` if not assigned.
* `dim`: Maximum photon number for truncate.
"""
function FockState(T::Type{<:Number}, n::Integer, ::Type{Vector}; dim)
    v = zeros(T, dim); v[n+1] = one(T)

    return v
end

function FockState(T::Type{<:Number}, n::Integer, ::Type{Matrix}; dim)
    ρ = zeros(T, dim, dim); ρ[n+1, n+1] = one(T)

    return ρ
end

FockState(n, rep; dim) = FockState(Float64, n, rep, dim=dim)

FockState(n; dim) = FockState(n, Vector, dim=dim)

const NumberState = FockState

"""
    VacuumState([T::Type{<:Number}], [rep::Type]; dim::Integer)

Construct a vacuum state in `rep` representation.

## Arguments

* `T`: Numerical type. Default as `Float64` if not assigned.
* `rep`:In which representation, default as `Vector` if not assigned.
* `dim`: Maximum photon number for truncate.
"""
VacuumState(T, rep; dim) = FockState(T, 0, rep, dim=dim)

VacuumState(rep; dim) = FockState(Float64, 0, rep, dim=dim)

VacuumState(; dim) = FockState(0, Vector, dim=dim)

"""
    SinglePhotonState([T::Type{<:Number}], [rep::Type]; dim::Integer)

Construct a single photon state in `rep` representation.

## Arguments

* `T`: Numerical type. Default as `Float64` if not assigned.
* `rep`:In which representation, default as `Vector` if not assigned.
* `dim`: Maximum photon number for truncate.
"""
SinglePhotonState(T, rep; dim) = FockState(T, 1, rep, dim=dim)

SinglePhotonState(rep; dim) = FockState(Float64, 1, rep, dim=dim)

SinglePhotonState(; dim) = FockState(1, Vector, dim=dim)

##### pure state #####

### coherent state

"""
    CoherentState([T::Type{<:Complex}], r::Real, θ::Real, [rep::Type]; dim::Integer)

Construct a coherent state in `rep` representation.

* `T`: Numerical type. Default as `ComplexF64` if not assigned.
* `r`: The radius in phase space.
* `θ`: The phase angle in phase space.
* `rep`:In which representation, default as `Vector` if not assigned.
* `dim`: Maximum photon number for truncate.
"""
function CoherentState(T::Type{<:Complex}, r, θ, rep; dim)
    return displace(VacuumState(real(T), rep, dim=dim), r, θ)
end

CoherentState(r, θ, rep; dim) = CoherentState(ComplexF64, r, θ, rep, dim=dim)

CoherentState(r, θ; dim) = CoherentState(r, θ, Vector, dim=dim)

### squeezed state

"""
    SqueezedState([T::Type{<:Complex}], r::Real, θ::Real, [rep::Type]; dim::Integer)

Construct a squeezed state in `rep` representation.

Squeezed state is defined if its electric field strength for some phases has a quantum
uncertainty smaller than that of a coherent state.

## Arguments

* `T`: Numerical type. Default as `ComplexF64` if not assigned.
* `r`: The squeezing level.
* `θ`: The squeezing phase.
* `rep`:In which representation, default as `Vector` if not assigned.
* `dim`: Maximum photon number for truncate.

This constructor will construct ``| \\xi \\rangle = \\hat{S}(\\xi) | 0 \\rangle``
"""
function SqueezedState(T::Type{<:Complex}, r, θ, rep; dim)
    return squeeze(VacuumState(real(T), rep, dim=dim), r, θ)
end

SqueezedState(r, θ, rep; dim) = SqueezedState(ComplexF64, r, θ, rep, dim=dim)

SqueezedState(r, θ; dim) = SqueezedState(r, θ, Vector, dim=dim)

##### mixed state #####

### thermal state

bose_einstein(n::Number, n̄::Real) = n̄^n / (1 + n̄)^(n+1)

bose_einstein(n̄) = n -> bose_einstein(n, n̄)

"""
    ThermalState([T::Type{<:Number}], n̄::Real; dim::Integer)

Construct a thermal state.

Thermal state is a mixed state with photon number distribution described by
Bose-Einstein distribution.

## Arguments

* `T`: Numerical type. Default as `Float64` if not assigned.
* `n̄`: Average photon number at a certain temperature.
* `dim`: Maximum photon number for truncate.
"""
ThermalState(T::Type{<:Number}, n̄; dim) = diagm(bose_einstein(n̄).(T.(0:dim-1)))

ThermalState(n̄; dim) = ThermalState(Float64, n̄, dim=dim)

### squeezed thermal state

"""
    SqueezedThermalState([T::Type{<:Complex}], r::Real, θ::Real, n̄::Real; dim::Integer)

Construct a squeezed thermal state.

Squeezed thermal state is defined if its electric field strength for some phases has a
quantum uncertainty smaller than that of a coherent state.

## Arguments

* `T`: Numeric type. Default as `ComplexF64` if not assigned.
* `r`: Squeezing level.
* `θ`: Squeezing phase.
* `n̄`: Average photon number at a certain temperature.
* `dim`: Maximum photon number for truncate.

This constructor will construct ``\\rho = \\hat{S}(\\xi) \\rho_{th} \\hat{S}(\\xi)^{T}``
"""
function SqueezedThermalState(T::Type{<:Complex}, r, θ, n̄; dim)
    return squeeze(ThermalState(real(T), n̄, dim=dim), r, θ)
end

SqueezedThermalState(r, θ, n̄; dim) = SqueezedThermalState(ComplexF64, r, θ, n̄, dim=dim)

###########
# methods #
###########

# TODO: ρ(v)
# TODO: purity(ρ)
# TODO: fidelity(ρ1, ρ2)
# TODO: fidelity(v1, v2) ???


text:
const julia07 = VERSION > v"0.6.5"

if julia07
    using Libdl
end

dlls = Libdl.dllist()

libjulia = (filter(dlls) do dl
    if julia07
        occursin(Regex("^libjulia(?:.*)\\.$(Libdl.dlext)(?:\\..+)?\$"), basename(dl))
    else
        ismatch(Regex("^libjulia(?:.*)\\.$(Libdl.dlext)(?:\\..+)?\$"), basename(dl))
    end
end)[1]

print(libjulia)

max_stars_repo_name: KevCaz/JuliaCall

max_issues_repo_name: tinagui/JuliaCall

max_forks_repo_name: tinagui/JuliaCall


text:
module YangSimOpt

include("./interfaces/nrelssc/nrelssc.jl")

end


text:
using Plots, GLM
plotlyjs()
macro halfwidth_plot_defaults()
    return :(default(
        legendfontsize=14,
        titlefontsize=18,
        xlabelfontsize=18,
        ylabelfontsize=18,
        xtickfontsize=18,
        ytickfontsize=18,
        fg_legend=:false,
        legend=:outerbottomright,
    ))
end

macro fullwidth_plot_defaults()
    return :(default(
        legendfontsize=12,
        titlefontsize=16,
        xlabelfontsize=12,
        ylabelfontsize=12,
        xtickfontsize=12,
        ytickfontsize=12,
        size=(600, 300),
        fg_legend=:false,
    ))
end

macro fit_error_lm(data,dir)
    data_name = string(data)
    return quote
        fit_error_lm($data_name,$(esc(data)),$(esc(dir)))
    end
end

macro fit_error_lm_log_first(data,dir)
    data_name = string(data)
    return quote
        fit_error_lm_log_first($data_name,$(esc(data)),$(esc(dir)))
    end
end

function fit_error_lm(data_name,data,dir)
    lines = Dict()
    open(dir*"/"*data_name*"_fit.txt","w") do io
        for (c,n) in enumerate(names(data))
            if c<5
                m = lm([ones(8) log10.(7:2:21)], data[4:end,n])
                println(io,string("Fit log(KS) = β₀ + β₁log(N), for method ",n))
                println(io,m)
                lines[n] = (x=log10.(7:2:21),y=[ones(8) log10.(7:2:21)]*coef(m),slope=coef(m)[2],p=coeftable(m).cols[4][2])
            else
                m = lm([ones(8) log10.((7:2:21).+1)], data[4:end,n])
                println(io,string("Fit log(KS) = β₀ + β₁log(N), for method ",n))
                println(io,m)
                lines[n] = (x=log10.((7:2:21).+1),y=[ones(8) log10.((7:2:21).+1)]*coef(m),slope=coef(m)[2],p=coeftable(m).cols[4][2])
            end
        end
    end
    return lines
end

function fit_error_lm_log_first(data_name,data,dir)
    data2 = copy(data)
    for n in names(data2)
        transform!(data2, n => (x->log10.(x)) => n)
    end
    lines = fit_error_lm(data_name,data2,dir)
    return lines
end

function error_ticks!(p)
    oldticks = yticks(p)[1]
    if minimum(oldticks[1])<-3
        yticks!(p,oldticks[1],string.("1e",round.(oldticks[1],digits=1)))
    else
        yticks!(p,oldticks[1],[string(10.0.^k+0.00001)[1:5] for k in oldticks[1]])
    end
    # plot!(p,yformatter = :scientific)
    ticks = round.(log10.([1;3;9;21]),digits=2)
    xticks!(p,ticks,["1","3","9","21"])
end

macro add_lines!(data,names_set,dir)
    data_name = string(data)
    return :(add_lines!($data_name,$(esc(data)),$(esc(names_set)),$(esc(dir))))
end

function add_lines!(data_name,data,names_set,dir)
    if "naive"∈names(data)
        data = data[:,Not("naive")]
    end
    if data[end,1] < 0.0
        lines = fit_error_lm(data_name,data,dir)
    else
        lines = fit_error_lm_log_first(data_name,data,dir)
    end

    plot!(xlims=(xlims(plot!())[1],log10(21)+0.125))#.+(0,0.05))
    biggest = maximum(abs.([lines[i].y[end] for i in names(data)]))
    for col in names(data)
        distances = (lines[col].y[end].-[lines[i].y[end] for i in names(data[:,Not(col)])])./biggest
        ~, idx = findmin(abs.(distances))
        closest = distances[idx]
        if (lines[col].slope<-0.1)&&(lines[col].p<0.005)
            plot!(
                lines[col].x,lines[col].y,linestyle=:dot,label=false,
                color=:black,linewidth=2,
                # series_annotation=[fill("",length(lines[col].x)-1);string("",round(lines[col].slope,digits=2))],
            )
            if (abs(closest)<0.05)&&(closest<=0.0)
                annotate!((lines[col].x[end]+0.09,lines[col].y[end]-0.025*biggest,string(round(lines[col].slope,digits=2))))
            elseif (abs(closest)<0.05)&&(closest>0.0)
                annotate!((lines[col].x[end]+0.09,lines[col].y[end]+0.025*biggest,string(round(lines[col].slope,digits=2))))
            else
                annotate!((lines[col].x[end]+0.09,lines[col].y[end],string(round(lines[col].slope,digits=2))))
            end
        end
    end
    return lines
end


text:
#=
  From
  "Probabilistic logic programming and its applications"
  Luc De Raedt, Leuven
  https://www.youtube.com/watch?v=3lnVBqxjC88
  @ 3:44

  """
  Mike has a bag of marbles with 4 white, 8 blue, and
  6 red marbles. He pulls out one marble from the bag
  and it is red. What is the probability that the
  second marble he pulls out of the bag is white?

  The answer is 0.234931.
  """

  draw1: The probability of drawing white is the probability for 1.0
  Distributions of variable draw1
  blue       =>   47204  (0.472040)
  red        =>   29283  (0.292830)
  white      =>   23513  (0.235130)

  Cf ~/cplint/bag_of_marbles.pl
     ~/blog/bag_of_marbles.blog
     ~/psi/bag_of_marbles.psi
     ~/webppl/bag_of_marbles.wppl

  Also see bag_of_marbles2.jl for an alternative approach (using recursion).

=#

using Turing, StatsPlots, DataFrames
include("jl_utils.jl")

@model function bag_of_marbles()

    white = 1
    blue  = 2
    red   = 3
    colors = [white,blue,red]

    start = [4,8,6];

    draw0 ~ Categorical(simplex([start[white],start[blue],start[red]]))

    if draw0 == white
        draw1 ~ Categorical(simplex([start[white]-1,start[blue],start[red]]))
    elseif draw0==blue
        draw1 ~ Categorical(simplex([start[white],start[blue]-1,start[red]]))
    else
        # red
        draw1 ~ Categorical([start[white],start[blue],start[red]-1]|>simplex);
    end

    true ~ Dirac(draw0 == red)

end

model = bag_of_marbles()
num_chns = 4

# chns = sample(model, Prior(), 100_000)
chns = sample(model, MH(), 100_000)

# chns = sample(model, PG(15), 10_000)
# chns = sample(model, SMC(), 10_000)

# Note: IS don't generate chns the same way as MH, PG, and SMC!
# chns = sample(model, IS(), 10_000)

display(chns)

show_var_dist_pct(chns,:draw0,["white","blue","red"])
println("\ndraw1: The probability of drawing white is the probability for 1.0")
show_var_dist_pct(chns,:draw1,["white","blue","red"])

max_stars_repo_name: tias/hakank

max_issues_repo_name: tias/hakank

max_forks_repo_name: tias/hakank