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

"""
    cancel_image_creation(client_token, image_build_version_arn)
    cancel_image_creation(client_token, image_build_version_arn, params::Dict{String,<:Any})

CancelImageCreation cancels the creation of Image. This operation can only be used on
images in a non-terminal state.

# Arguments
- `client_token`: The idempotency token used to make this request idempotent.
- `image_build_version_arn`: The Amazon Resource Name (ARN) of the image whose creation you
  want to cancel.

"""
cancel_image_creation(clientToken, imageBuildVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CancelImageCreation", Dict{String, Any}("clientToken"=>clientToken, "imageBuildVersionArn"=>imageBuildVersionArn); aws_config=aws_config)
cancel_image_creation(clientToken, imageBuildVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CancelImageCreation", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "imageBuildVersionArn"=>imageBuildVersionArn), params)); aws_config=aws_config)

"""
    create_component(client_token, name, platform, semantic_version)
    create_component(client_token, name, platform, semantic_version, params::Dict{String,<:Any})

Creates a new component that can be used to build, validate, test, and assess your image.

# Arguments
- `client_token`: The idempotency token of the component.
- `name`: The name of the component.
- `platform`: The platform of the component.
- `semantic_version`: The semantic version of the component. This version follows the
  semantic version syntax. For example, major.minor.patch. This could be versioned like
  software (2.0.1) or like a date (2019.12.01).

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"changeDescription"`: The change description of the component. Describes what change has
  been made in this version, or what makes this version different from other versions of this
  component.
- `"data"`: The data of the component. Used to specify the data inline. Either data or uri
  can be used to specify the data within the component.
- `"description"`: The description of the component. Describes the contents of the
  component.
- `"kmsKeyId"`: The ID of the KMS key that should be used to encrypt this component.
- `"supportedOsVersions"`:  The operating system (OS) version supported by the component.
  If the OS information is available, a prefix match is performed against the parent image OS
  version during image recipe creation.
- `"tags"`: The tags of the component.
- `"uri"`: The uri of the component. Must be an S3 URL and the requester must have
  permission to access the S3 bucket. If you use S3, you can specify component content up to
  your service quota. Either data or uri can be used to specify the data within the component.
"""
create_component(clientToken, name, platform, semanticVersion; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateComponent", Dict{String, Any}("clientToken"=>clientToken, "name"=>name, "platform"=>platform, "semanticVersion"=>semanticVersion); aws_config=aws_config)
create_component(clientToken, name, platform, semanticVersion, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateComponent", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "name"=>name, "platform"=>platform, "semanticVersion"=>semanticVersion), params)); aws_config=aws_config)

"""
    create_container_recipe(client_token, components, container_type, dockerfile_template_data, name, parent_image, semantic_version, target_repository)
    create_container_recipe(client_token, components, container_type, dockerfile_template_data, name, parent_image, semantic_version, target_repository, params::Dict{String,<:Any})

Creates a new container recipe. Container recipes define how images are configured, tested,
and assessed.

# Arguments
- `client_token`: The client token used to make this request idempotent.
- `components`: Components for build and test that are included in the container recipe.
- `container_type`: The type of container to create.
- `dockerfile_template_data`: The Dockerfile template used to build your image as an inline
  data blob.
- `name`: The name of the container recipe.
- `parent_image`: The source image for the container recipe.
- `semantic_version`: The semantic version of the container recipe
  (<major>.<minor>.<patch>).
- `target_repository`: The destination repository for the container image.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: The description of the container recipe.
- `"dockerfileTemplateUri"`: The S3 URI for the Dockerfile that will be used to build your
  container image.
- `"imageOsVersionOverride"`: Specifies the operating system version for the source image.
- `"kmsKeyId"`: Identifies which KMS key is used to encrypt the container image.
- `"platformOverride"`: Specifies the operating system platform when you use a custom
  source image.
- `"tags"`: Tags that are attached to the container recipe.
- `"workingDirectory"`: The working directory for use during build and test workflows.
"""
create_container_recipe(clientToken, components, containerType, dockerfileTemplateData, name, parentImage, semanticVersion, targetRepository; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateContainerRecipe", Dict{String, Any}("clientToken"=>clientToken, "components"=>components, "containerType"=>containerType, "dockerfileTemplateData"=>dockerfileTemplateData, "name"=>name, "parentImage"=>parentImage, "semanticVersion"=>semanticVersion, "targetRepository"=>targetRepository); aws_config=aws_config)
create_container_recipe(clientToken, components, containerType, dockerfileTemplateData, name, parentImage, semanticVersion, targetRepository, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateContainerRecipe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "components"=>components, "containerType"=>containerType, "dockerfileTemplateData"=>dockerfileTemplateData, "name"=>name, "parentImage"=>parentImage, "semanticVersion"=>semanticVersion, "targetRepository"=>targetRepository), params)); aws_config=aws_config)

"""
    create_distribution_configuration(client_token, distributions, name)
    create_distribution_configuration(client_token, distributions, name, params::Dict{String,<:Any})

Creates a new distribution configuration. Distribution configurations define and configure
the outputs of your pipeline.

# Arguments
- `client_token`:  The idempotency token of the distribution configuration.
- `distributions`:  The distributions of the distribution configuration.
- `name`:  The name of the distribution configuration.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`:  The description of the distribution configuration.
- `"tags"`:  The tags of the distribution configuration.
"""
create_distribution_configuration(clientToken, distributions, name; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateDistributionConfiguration", Dict{String, Any}("clientToken"=>clientToken, "distributions"=>distributions, "name"=>name); aws_config=aws_config)
create_distribution_configuration(clientToken, distributions, name, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateDistributionConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "distributions"=>distributions, "name"=>name), params)); aws_config=aws_config)

"""
    create_image(client_token, infrastructure_configuration_arn)
    create_image(client_token, infrastructure_configuration_arn, params::Dict{String,<:Any})

 Creates a new image. This request will create a new image along with all of the configured
output resources defined in the distribution configuration.

# Arguments
- `client_token`:  The idempotency token used to make this request idempotent.
- `infrastructure_configuration_arn`:  The Amazon Resource Name (ARN) of the infrastructure
  configuration that defines the environment in which your image will be built and tested.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"containerRecipeArn"`: The Amazon Resource Name (ARN) of the container recipe that
  defines how images are configured and tested.
- `"distributionConfigurationArn"`:  The Amazon Resource Name (ARN) of the distribution
  configuration that defines and configures the outputs of your pipeline.
- `"enhancedImageMetadataEnabled"`:  Collects additional information about the image being
  created, including the operating system (OS) version and package list. This information is
  used to enhance the overall experience of using EC2 Image Builder. Enabled by default.
- `"imageRecipeArn"`:  The Amazon Resource Name (ARN) of the image recipe that defines how
  images are configured, tested, and assessed.
- `"imageTestsConfiguration"`:  The image tests configuration of the image.
- `"tags"`:  The tags of the image.
"""
create_image(clientToken, infrastructureConfigurationArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateImage", Dict{String, Any}("clientToken"=>clientToken, "infrastructureConfigurationArn"=>infrastructureConfigurationArn); aws_config=aws_config)
create_image(clientToken, infrastructureConfigurationArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateImage", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "infrastructureConfigurationArn"=>infrastructureConfigurationArn), params)); aws_config=aws_config)

"""
    create_image_pipeline(client_token, infrastructure_configuration_arn, name)
    create_image_pipeline(client_token, infrastructure_configuration_arn, name, params::Dict{String,<:Any})

 Creates a new image pipeline. Image pipelines enable you to automate the creation and
distribution of images.

# Arguments
- `client_token`:  The idempotency token used to make this request idempotent.
- `infrastructure_configuration_arn`:  The Amazon Resource Name (ARN) of the infrastructure
  configuration that will be used to build images created by this image pipeline.
- `name`:  The name of the image pipeline.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"containerRecipeArn"`: The Amazon Resource Name (ARN) of the container recipe that is
  used to configure images created by this container pipeline.
- `"description"`:  The description of the image pipeline.
- `"distributionConfigurationArn"`:  The Amazon Resource Name (ARN) of the distribution
  configuration that will be used to configure and distribute images created by this image
  pipeline.
- `"enhancedImageMetadataEnabled"`:  Collects additional information about the image being
  created, including the operating system (OS) version and package list. This information is
  used to enhance the overall experience of using EC2 Image Builder. Enabled by default.
- `"imageRecipeArn"`:  The Amazon Resource Name (ARN) of the image recipe that will be used
  to configure images created by this image pipeline.
- `"imageTestsConfiguration"`:  The image test configuration of the image pipeline.
- `"schedule"`:  The schedule of the image pipeline.
- `"status"`:  The status of the image pipeline.
- `"tags"`:  The tags of the image pipeline.
"""
create_image_pipeline(clientToken, infrastructureConfigurationArn, name; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateImagePipeline", Dict{String, Any}("clientToken"=>clientToken, "infrastructureConfigurationArn"=>infrastructureConfigurationArn, "name"=>name); aws_config=aws_config)
create_image_pipeline(clientToken, infrastructureConfigurationArn, name, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateImagePipeline", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "infrastructureConfigurationArn"=>infrastructureConfigurationArn, "name"=>name), params)); aws_config=aws_config)

"""
    create_image_recipe(client_token, components, name, parent_image, semantic_version)
    create_image_recipe(client_token, components, name, parent_image, semantic_version, params::Dict{String,<:Any})

 Creates a new image recipe. Image recipes define how images are configured, tested, and
assessed.

# Arguments
- `client_token`: The idempotency token used to make this request idempotent.
- `components`: The components of the image recipe.
- `name`:  The name of the image recipe.
- `parent_image`: The parent image of the image recipe. The value of the string can be the
  ARN of the parent image or an AMI ID. The format for the ARN follows this example:
  arn:aws:imagebuilder:us-west-2:aws:image/windows-server-2016-english-full-base-x86/xxxx.x.x
  . You can provide the specific version that you want to use, or you can use a wildcard in
  all of the fields. If you enter an AMI ID for the string value, you must have access to the
  AMI, and the AMI must be in the same Region in which you are using Image Builder.
- `semantic_version`: The semantic version of the image recipe.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"blockDeviceMappings"`: The block device mappings of the image recipe.
- `"description"`:  The description of the image recipe.
- `"tags"`:  The tags of the image recipe.
- `"workingDirectory"`: The working directory to be used during build and test workflows.
"""
create_image_recipe(clientToken, components, name, parentImage, semanticVersion; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateImageRecipe", Dict{String, Any}("clientToken"=>clientToken, "components"=>components, "name"=>name, "parentImage"=>parentImage, "semanticVersion"=>semanticVersion); aws_config=aws_config)
create_image_recipe(clientToken, components, name, parentImage, semanticVersion, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateImageRecipe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "components"=>components, "name"=>name, "parentImage"=>parentImage, "semanticVersion"=>semanticVersion), params)); aws_config=aws_config)

"""
    create_infrastructure_configuration(client_token, instance_profile_name, name)
    create_infrastructure_configuration(client_token, instance_profile_name, name, params::Dict{String,<:Any})

 Creates a new infrastructure configuration. An infrastructure configuration defines the
environment in which your image will be built and tested.

# Arguments
- `client_token`: The idempotency token used to make this request idempotent.
- `instance_profile_name`: The instance profile to associate with the instance used to
  customize your EC2 AMI.
- `name`: The name of the infrastructure configuration.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: The description of the infrastructure configuration.
- `"instanceTypes"`: The instance types of the infrastructure configuration. You can
  specify one or more instance types to use for this build. The service will pick one of
  these instance types based on availability.
- `"keyPair"`: The key pair of the infrastructure configuration. This can be used to log on
  to and debug the instance used to create your image.
- `"logging"`: The logging configuration of the infrastructure configuration.
- `"resourceTags"`: The tags attached to the resource created by Image Builder.
- `"securityGroupIds"`: The security group IDs to associate with the instance used to
  customize your EC2 AMI.
- `"snsTopicArn"`: The SNS topic on which to send image build events.
- `"subnetId"`: The subnet ID in which to place the instance used to customize your EC2
  AMI.
- `"tags"`: The tags of the infrastructure configuration.
- `"terminateInstanceOnFailure"`: The terminate instance on failure setting of the
  infrastructure configuration. Set to false if you want Image Builder to retain the instance
  used to configure your AMI if the build or test phase of your workflow fails.
"""
create_infrastructure_configuration(clientToken, instanceProfileName, name; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateInfrastructureConfiguration", Dict{String, Any}("clientToken"=>clientToken, "instanceProfileName"=>instanceProfileName, "name"=>name); aws_config=aws_config)
create_infrastructure_configuration(clientToken, instanceProfileName, name, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/CreateInfrastructureConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "instanceProfileName"=>instanceProfileName, "name"=>name), params)); aws_config=aws_config)

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

 Deletes a component build version.

# Arguments
- `component_build_version_arn`: The Amazon Resource Name (ARN) of the component build
  version to delete.

"""
delete_component(componentBuildVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteComponent", Dict{String, Any}("componentBuildVersionArn"=>componentBuildVersionArn); aws_config=aws_config)
delete_component(componentBuildVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteComponent", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("componentBuildVersionArn"=>componentBuildVersionArn), params)); aws_config=aws_config)

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

Deletes a container recipe.

# Arguments
- `container_recipe_arn`: The Amazon Resource Name (ARN) of the container recipe to delete.

"""
delete_container_recipe(containerRecipeArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteContainerRecipe", Dict{String, Any}("containerRecipeArn"=>containerRecipeArn); aws_config=aws_config)
delete_container_recipe(containerRecipeArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteContainerRecipe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("containerRecipeArn"=>containerRecipeArn), params)); aws_config=aws_config)

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

 Deletes a distribution configuration.

# Arguments
- `distribution_configuration_arn`: The Amazon Resource Name (ARN) of the distribution
  configuration to delete.

"""
delete_distribution_configuration(distributionConfigurationArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteDistributionConfiguration", Dict{String, Any}("distributionConfigurationArn"=>distributionConfigurationArn); aws_config=aws_config)
delete_distribution_configuration(distributionConfigurationArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteDistributionConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("distributionConfigurationArn"=>distributionConfigurationArn), params)); aws_config=aws_config)

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

 Deletes an image.

# Arguments
- `image_build_version_arn`: The Amazon Resource Name (ARN) of the image to delete.

"""
delete_image(imageBuildVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteImage", Dict{String, Any}("imageBuildVersionArn"=>imageBuildVersionArn); aws_config=aws_config)
delete_image(imageBuildVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteImage", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageBuildVersionArn"=>imageBuildVersionArn), params)); aws_config=aws_config)

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

 Deletes an image pipeline.

# Arguments
- `image_pipeline_arn`: The Amazon Resource Name (ARN) of the image pipeline to delete.

"""
delete_image_pipeline(imagePipelineArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteImagePipeline", Dict{String, Any}("imagePipelineArn"=>imagePipelineArn); aws_config=aws_config)
delete_image_pipeline(imagePipelineArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteImagePipeline", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imagePipelineArn"=>imagePipelineArn), params)); aws_config=aws_config)

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

 Deletes an image recipe.

# Arguments
- `image_recipe_arn`: The Amazon Resource Name (ARN) of the image recipe to delete.

"""
delete_image_recipe(imageRecipeArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteImageRecipe", Dict{String, Any}("imageRecipeArn"=>imageRecipeArn); aws_config=aws_config)
delete_image_recipe(imageRecipeArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteImageRecipe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageRecipeArn"=>imageRecipeArn), params)); aws_config=aws_config)

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

 Deletes an infrastructure configuration.

# Arguments
- `infrastructure_configuration_arn`: The Amazon Resource Name (ARN) of the infrastructure
  configuration to delete.

"""
delete_infrastructure_configuration(infrastructureConfigurationArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteInfrastructureConfiguration", Dict{String, Any}("infrastructureConfigurationArn"=>infrastructureConfigurationArn); aws_config=aws_config)
delete_infrastructure_configuration(infrastructureConfigurationArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("DELETE", "/DeleteInfrastructureConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("infrastructureConfigurationArn"=>infrastructureConfigurationArn), params)); aws_config=aws_config)

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

 Gets a component object.

# Arguments
- `component_build_version_arn`: The Amazon Resource Name (ARN) of the component that you
  want to retrieve. Regex requires \"/d+\" suffix.

"""
get_component(componentBuildVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetComponent", Dict{String, Any}("componentBuildVersionArn"=>componentBuildVersionArn); aws_config=aws_config)
get_component(componentBuildVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetComponent", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("componentBuildVersionArn"=>componentBuildVersionArn), params)); aws_config=aws_config)

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

 Gets a component policy.

# Arguments
- `component_arn`: The Amazon Resource Name (ARN) of the component whose policy you want to
  retrieve.

"""
get_component_policy(componentArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetComponentPolicy", Dict{String, Any}("componentArn"=>componentArn); aws_config=aws_config)
get_component_policy(componentArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetComponentPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("componentArn"=>componentArn), params)); aws_config=aws_config)

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

Retrieves a container recipe.

# Arguments
- `container_recipe_arn`: The Amazon Resource Name (ARN) of the container recipe to
  retrieve.

"""
get_container_recipe(containerRecipeArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetContainerRecipe", Dict{String, Any}("containerRecipeArn"=>containerRecipeArn); aws_config=aws_config)
get_container_recipe(containerRecipeArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetContainerRecipe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("containerRecipeArn"=>containerRecipeArn), params)); aws_config=aws_config)

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

Retrieves the policy for a container recipe.

# Arguments
- `container_recipe_arn`: The Amazon Resource Name (ARN) of the container recipe for the
  policy being requested.

"""
get_container_recipe_policy(containerRecipeArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetContainerRecipePolicy", Dict{String, Any}("containerRecipeArn"=>containerRecipeArn); aws_config=aws_config)
get_container_recipe_policy(containerRecipeArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetContainerRecipePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("containerRecipeArn"=>containerRecipeArn), params)); aws_config=aws_config)

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

 Gets a distribution configuration.

# Arguments
- `distribution_configuration_arn`: The Amazon Resource Name (ARN) of the distribution
  configuration that you want to retrieve.

"""
get_distribution_configuration(distributionConfigurationArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetDistributionConfiguration", Dict{String, Any}("distributionConfigurationArn"=>distributionConfigurationArn); aws_config=aws_config)
get_distribution_configuration(distributionConfigurationArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetDistributionConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("distributionConfigurationArn"=>distributionConfigurationArn), params)); aws_config=aws_config)

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

 Gets an image.

# Arguments
- `image_build_version_arn`: The Amazon Resource Name (ARN) of the image that you want to
  retrieve.

"""
get_image(imageBuildVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImage", Dict{String, Any}("imageBuildVersionArn"=>imageBuildVersionArn); aws_config=aws_config)
get_image(imageBuildVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImage", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageBuildVersionArn"=>imageBuildVersionArn), params)); aws_config=aws_config)

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

 Gets an image pipeline.

# Arguments
- `image_pipeline_arn`: The Amazon Resource Name (ARN) of the image pipeline that you want
  to retrieve.

"""
get_image_pipeline(imagePipelineArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImagePipeline", Dict{String, Any}("imagePipelineArn"=>imagePipelineArn); aws_config=aws_config)
get_image_pipeline(imagePipelineArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImagePipeline", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imagePipelineArn"=>imagePipelineArn), params)); aws_config=aws_config)

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

 Gets an image policy.

# Arguments
- `image_arn`: The Amazon Resource Name (ARN) of the image whose policy you want to
  retrieve.

"""
get_image_policy(imageArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImagePolicy", Dict{String, Any}("imageArn"=>imageArn); aws_config=aws_config)
get_image_policy(imageArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImagePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageArn"=>imageArn), params)); aws_config=aws_config)

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

 Gets an image recipe.

# Arguments
- `image_recipe_arn`: The Amazon Resource Name (ARN) of the image recipe that you want to
  retrieve.

"""
get_image_recipe(imageRecipeArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImageRecipe", Dict{String, Any}("imageRecipeArn"=>imageRecipeArn); aws_config=aws_config)
get_image_recipe(imageRecipeArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImageRecipe", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageRecipeArn"=>imageRecipeArn), params)); aws_config=aws_config)

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

 Gets an image recipe policy.

# Arguments
- `image_recipe_arn`: The Amazon Resource Name (ARN) of the image recipe whose policy you
  want to retrieve.

"""
get_image_recipe_policy(imageRecipeArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImageRecipePolicy", Dict{String, Any}("imageRecipeArn"=>imageRecipeArn); aws_config=aws_config)
get_image_recipe_policy(imageRecipeArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetImageRecipePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageRecipeArn"=>imageRecipeArn), params)); aws_config=aws_config)

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

 Gets an infrastructure configuration.

# Arguments
- `infrastructure_configuration_arn`: The Amazon Resource Name (ARN) of the infrastructure
  configuration that you want to retrieve.

"""
get_infrastructure_configuration(infrastructureConfigurationArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetInfrastructureConfiguration", Dict{String, Any}("infrastructureConfigurationArn"=>infrastructureConfigurationArn); aws_config=aws_config)
get_infrastructure_configuration(infrastructureConfigurationArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("GET", "/GetInfrastructureConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("infrastructureConfigurationArn"=>infrastructureConfigurationArn), params)); aws_config=aws_config)

"""
    import_component(client_token, format, name, platform, semantic_version, type)
    import_component(client_token, format, name, platform, semantic_version, type, params::Dict{String,<:Any})

Imports a component and transforms its data into a component document.

# Arguments
- `client_token`: The idempotency token of the component.
- `format`: The format of the resource that you want to import as a component.
- `name`:  The name of the component.
- `platform`: The platform of the component.
- `semantic_version`: The semantic version of the component. This version follows the
  semantic version syntax. For example, major.minor.patch. This could be versioned like
  software (2.0.1) or like a date (2019.12.01).
- `type`: The type of the component denotes whether the component is used to build the
  image or only to test it.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"changeDescription"`: The change description of the component. Describes what change has
  been made in this version, or what makes this version different from other versions of this
  component.
- `"data"`: The data of the component. Used to specify the data inline. Either data or uri
  can be used to specify the data within the component.
- `"description"`: The description of the component. Describes the contents of the
  component.
- `"kmsKeyId"`: The ID of the KMS key that should be used to encrypt this component.
- `"tags"`: The tags of the component.
- `"uri"`: The uri of the component. Must be an S3 URL and the requester must have
  permission to access the S3 bucket. If you use S3, you can specify component content up to
  your service quota. Either data or uri can be used to specify the data within the
  component.
"""
import_component(clientToken, format, name, platform, semanticVersion, type; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/ImportComponent", Dict{String, Any}("clientToken"=>clientToken, "format"=>format, "name"=>name, "platform"=>platform, "semanticVersion"=>semanticVersion, "type"=>type); aws_config=aws_config)
import_component(clientToken, format, name, platform, semanticVersion, type, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/ImportComponent", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "format"=>format, "name"=>name, "platform"=>platform, "semanticVersion"=>semanticVersion, "type"=>type), params)); aws_config=aws_config)

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

 Returns the list of component build versions for the specified semantic version.

# Arguments
- `component_version_arn`: The component version Amazon Resource Name (ARN) whose versions
  you want to list.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_component_build_versions(componentVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListComponentBuildVersions", Dict{String, Any}("componentVersionArn"=>componentVersionArn); aws_config=aws_config)
list_component_build_versions(componentVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListComponentBuildVersions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("componentVersionArn"=>componentVersionArn), params)); aws_config=aws_config)

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

Returns the list of component build versions for the specified semantic version.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"byName"`: Returns the list of component build versions for the specified semantic
  version.
- `"filters"`: The filters.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
- `"owner"`: The owner defines which components you want to list. By default, this request
  will only show components owned by your account. You can use this field to specify if you
  want to view components owned by yourself, by Amazon, or those components that have been
  shared with you by other customers.
"""
list_components(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListComponents"; aws_config=aws_config)
list_components(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListComponents", params; aws_config=aws_config)

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

Returns a list of container recipes.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: Request filters that are used to narrow the list of container images that
  are returned.
- `"maxResults"`: The maximum number of results to return in the list.
- `"nextToken"`: Provides a token for pagination, which determines where to begin the next
  set of results when the current set reaches the maximum for one request.
- `"owner"`: Returns container recipes belonging to the specified owner, that have been
  shared with you. You can omit this field to return container recipes belonging to your
  account.
"""
list_container_recipes(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListContainerRecipes"; aws_config=aws_config)
list_container_recipes(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListContainerRecipes", params; aws_config=aws_config)

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

Returns a list of distribution configurations.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: The filters.     name - The name of this distribution configuration.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_distribution_configurations(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListDistributionConfigurations"; aws_config=aws_config)
list_distribution_configurations(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListDistributionConfigurations", params; aws_config=aws_config)

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

 Returns a list of image build versions.

# Arguments
- `image_version_arn`: The Amazon Resource Name (ARN) of the image whose build versions you
  want to retrieve.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: The filters.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_image_build_versions(imageVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImageBuildVersions", Dict{String, Any}("imageVersionArn"=>imageVersionArn); aws_config=aws_config)
list_image_build_versions(imageVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImageBuildVersions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageVersionArn"=>imageVersionArn), params)); aws_config=aws_config)

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

List the Packages that are associated with an Image Build Version, as determined by AWS
Systems Manager Inventory at build time.

# Arguments
- `image_build_version_arn`: Filter results for the ListImagePackages request by the Image
  Build Version ARN

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maxiumum number of results to return from the ListImagePackages
  request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_image_packages(imageBuildVersionArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImagePackages", Dict{String, Any}("imageBuildVersionArn"=>imageBuildVersionArn); aws_config=aws_config)
list_image_packages(imageBuildVersionArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImagePackages", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageBuildVersionArn"=>imageBuildVersionArn), params)); aws_config=aws_config)

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

 Returns a list of images created by the specified pipeline.

# Arguments
- `image_pipeline_arn`: The Amazon Resource Name (ARN) of the image pipeline whose images
  you want to view.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: The filters.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_image_pipeline_images(imagePipelineArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImagePipelineImages", Dict{String, Any}("imagePipelineArn"=>imagePipelineArn); aws_config=aws_config)
list_image_pipeline_images(imagePipelineArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImagePipelineImages", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imagePipelineArn"=>imagePipelineArn), params)); aws_config=aws_config)

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

Returns a list of image pipelines.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: The filters.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_image_pipelines(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImagePipelines"; aws_config=aws_config)
list_image_pipelines(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImagePipelines", params; aws_config=aws_config)

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

 Returns a list of image recipes.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: The filters.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
- `"owner"`: The owner defines which image recipes you want to list. By default, this
  request will only show image recipes owned by your account. You can use this field to
  specify if you want to view image recipes owned by yourself, by Amazon, or those image
  recipes that have been shared with you by other customers.
"""
list_image_recipes(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImageRecipes"; aws_config=aws_config)
list_image_recipes(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImageRecipes", params; aws_config=aws_config)

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

 Returns the list of images that you have access to.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"byName"`: Requests a list of images with a specific recipe name.
- `"filters"`: The filters.
- `"includeDeprecated"`: Includes deprecated images in the response list.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
- `"owner"`: The owner defines which images you want to list. By default, this request will
  only show images owned by your account. You can use this field to specify if you want to
  view images owned by yourself, by Amazon, or those images that have been shared with you by
  other customers.
"""
list_images(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImages"; aws_config=aws_config)
list_images(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListImages", params; aws_config=aws_config)

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

 Returns a list of infrastructure configurations.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"filters"`: The filters.
- `"maxResults"`: The maximum items to return in a request.
- `"nextToken"`: A token to specify where to start paginating. This is the NextToken from a
  previously truncated response.
"""
list_infrastructure_configurations(; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListInfrastructureConfigurations"; aws_config=aws_config)
list_infrastructure_configurations(params::AbstractDict{String, Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("POST", "/ListInfrastructureConfigurations", params; aws_config=aws_config)

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

 Returns the list of tags for the specified resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource whose tags you want to
  retrieve.

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

"""
    put_component_policy(component_arn, policy)
    put_component_policy(component_arn, policy, params::Dict{String,<:Any})

 Applies a policy to a component. We recommend that you call the RAM API
CreateResourceShare to share resources. If you call the Image Builder API
PutComponentPolicy, you must also call the RAM API PromoteResourceShareCreatedFromPolicy in
order for the resource to be visible to all principals with whom the resource is shared.

# Arguments
- `component_arn`: The Amazon Resource Name (ARN) of the component that this policy should
  be applied to.
- `policy`: The policy to apply.

"""
put_component_policy(componentArn, policy; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutComponentPolicy", Dict{String, Any}("componentArn"=>componentArn, "policy"=>policy); aws_config=aws_config)
put_component_policy(componentArn, policy, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutComponentPolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("componentArn"=>componentArn, "policy"=>policy), params)); aws_config=aws_config)

"""
    put_container_recipe_policy(container_recipe_arn, policy)
    put_container_recipe_policy(container_recipe_arn, policy, params::Dict{String,<:Any})

Applies a policy to a container image. We recommend that you call the RAM API
CreateResourceShare
(https://docs.aws.amazon.com/ram/latest/APIReference/API_CreateResourceShare.html) to share
resources. If you call the Image Builder API PutContainerImagePolicy, you must also call
the RAM API PromoteResourceShareCreatedFromPolicy
(https://docs.aws.amazon.com/ram/latest/APIReference/API_PromoteResourceShareCreatedFromPoli
cy.html) in order for the resource to be visible to all principals with whom the resource
is shared.

# Arguments
- `container_recipe_arn`: The Amazon Resource Name (ARN) of the container recipe that this
  policy should be applied to.
- `policy`: The policy to apply to the container recipe.

"""
put_container_recipe_policy(containerRecipeArn, policy; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutContainerRecipePolicy", Dict{String, Any}("containerRecipeArn"=>containerRecipeArn, "policy"=>policy); aws_config=aws_config)
put_container_recipe_policy(containerRecipeArn, policy, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutContainerRecipePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("containerRecipeArn"=>containerRecipeArn, "policy"=>policy), params)); aws_config=aws_config)

"""
    put_image_policy(image_arn, policy)
    put_image_policy(image_arn, policy, params::Dict{String,<:Any})

Applies a policy to an image. We recommend that you call the RAM API CreateResourceShare to
share resources. If you call the Image Builder API PutImagePolicy, you must also call the
RAM API PromoteResourceShareCreatedFromPolicy in order for the resource to be visible to
all principals with whom the resource is shared.

# Arguments
- `image_arn`: The Amazon Resource Name (ARN) of the image that this policy should be
  applied to.
- `policy`: The policy to apply.

"""
put_image_policy(imageArn, policy; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutImagePolicy", Dict{String, Any}("imageArn"=>imageArn, "policy"=>policy); aws_config=aws_config)
put_image_policy(imageArn, policy, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutImagePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageArn"=>imageArn, "policy"=>policy), params)); aws_config=aws_config)

"""
    put_image_recipe_policy(image_recipe_arn, policy)
    put_image_recipe_policy(image_recipe_arn, policy, params::Dict{String,<:Any})

 Applies a policy to an image recipe. We recommend that you call the RAM API
CreateResourceShare to share resources. If you call the Image Builder API
PutImageRecipePolicy, you must also call the RAM API PromoteResourceShareCreatedFromPolicy
in order for the resource to be visible to all principals with whom the resource is shared.

# Arguments
- `image_recipe_arn`: The Amazon Resource Name (ARN) of the image recipe that this policy
  should be applied to.
- `policy`: The policy to apply.

"""
put_image_recipe_policy(imageRecipeArn, policy; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutImageRecipePolicy", Dict{String, Any}("imageRecipeArn"=>imageRecipeArn, "policy"=>policy); aws_config=aws_config)
put_image_recipe_policy(imageRecipeArn, policy, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/PutImageRecipePolicy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("imageRecipeArn"=>imageRecipeArn, "policy"=>policy), params)); aws_config=aws_config)

"""
    start_image_pipeline_execution(client_token, image_pipeline_arn)
    start_image_pipeline_execution(client_token, image_pipeline_arn, params::Dict{String,<:Any})

 Manually triggers a pipeline to create an image.

# Arguments
- `client_token`: The idempotency token used to make this request idempotent.
- `image_pipeline_arn`: The Amazon Resource Name (ARN) of the image pipeline that you want
  to manually invoke.

"""
start_image_pipeline_execution(clientToken, imagePipelineArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/StartImagePipelineExecution", Dict{String, Any}("clientToken"=>clientToken, "imagePipelineArn"=>imagePipelineArn); aws_config=aws_config)
start_image_pipeline_execution(clientToken, imagePipelineArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/StartImagePipelineExecution", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "imagePipelineArn"=>imagePipelineArn), params)); aws_config=aws_config)

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

 Adds a tag to a resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource that you want to tag.
- `tags`: The tags to apply to the resource.

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

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

 Removes a tag from a resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource that you want to untag.
- `tag_keys`: The tag keys to remove from the resource.

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

"""
    update_distribution_configuration(client_token, distribution_configuration_arn, distributions)
    update_distribution_configuration(client_token, distribution_configuration_arn, distributions, params::Dict{String,<:Any})

 Updates a new distribution configuration. Distribution configurations define and configure
the outputs of your pipeline.

# Arguments
- `client_token`: The idempotency token of the distribution configuration.
- `distribution_configuration_arn`: The Amazon Resource Name (ARN) of the distribution
  configuration that you want to update.
- `distributions`: The distributions of the distribution configuration.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: The description of the distribution configuration.
"""
update_distribution_configuration(clientToken, distributionConfigurationArn, distributions; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/UpdateDistributionConfiguration", Dict{String, Any}("clientToken"=>clientToken, "distributionConfigurationArn"=>distributionConfigurationArn, "distributions"=>distributions); aws_config=aws_config)
update_distribution_configuration(clientToken, distributionConfigurationArn, distributions, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/UpdateDistributionConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "distributionConfigurationArn"=>distributionConfigurationArn, "distributions"=>distributions), params)); aws_config=aws_config)

"""
    update_image_pipeline(client_token, image_pipeline_arn, infrastructure_configuration_arn)
    update_image_pipeline(client_token, image_pipeline_arn, infrastructure_configuration_arn, params::Dict{String,<:Any})

 Updates a new image pipeline. Image pipelines enable you to automate the creation and
distribution of images.

# Arguments
- `client_token`: The idempotency token used to make this request idempotent.
- `image_pipeline_arn`: The Amazon Resource Name (ARN) of the image pipeline that you want
  to update.
- `infrastructure_configuration_arn`: The Amazon Resource Name (ARN) of the infrastructure
  configuration that will be used to build images updated by this image pipeline.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"containerRecipeArn"`: The Amazon Resource Name (ARN) of the container pipeline to
  update.
- `"description"`: The description of the image pipeline.
- `"distributionConfigurationArn"`: The Amazon Resource Name (ARN) of the distribution
  configuration that will be used to configure and distribute images updated by this image
  pipeline.
- `"enhancedImageMetadataEnabled"`:  Collects additional information about the image being
  created, including the operating system (OS) version and package list. This information is
  used to enhance the overall experience of using EC2 Image Builder. Enabled by default.
- `"imageRecipeArn"`: The Amazon Resource Name (ARN) of the image recipe that will be used
  to configure images updated by this image pipeline.
- `"imageTestsConfiguration"`: The image test configuration of the image pipeline.
- `"schedule"`: The schedule of the image pipeline.
- `"status"`: The status of the image pipeline.
"""
update_image_pipeline(clientToken, imagePipelineArn, infrastructureConfigurationArn; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/UpdateImagePipeline", Dict{String, Any}("clientToken"=>clientToken, "imagePipelineArn"=>imagePipelineArn, "infrastructureConfigurationArn"=>infrastructureConfigurationArn); aws_config=aws_config)
update_image_pipeline(clientToken, imagePipelineArn, infrastructureConfigurationArn, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/UpdateImagePipeline", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "imagePipelineArn"=>imagePipelineArn, "infrastructureConfigurationArn"=>infrastructureConfigurationArn), params)); aws_config=aws_config)

"""
    update_infrastructure_configuration(client_token, infrastructure_configuration_arn, instance_profile_name)
    update_infrastructure_configuration(client_token, infrastructure_configuration_arn, instance_profile_name, params::Dict{String,<:Any})

 Updates a new infrastructure configuration. An infrastructure configuration defines the
environment in which your image will be built and tested.

# Arguments
- `client_token`: The idempotency token used to make this request idempotent.
- `infrastructure_configuration_arn`: The Amazon Resource Name (ARN) of the infrastructure
  configuration that you want to update.
- `instance_profile_name`: The instance profile to associate with the instance used to
  customize your EC2 AMI.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"description"`: The description of the infrastructure configuration.
- `"instanceTypes"`: The instance types of the infrastructure configuration. You can
  specify one or more instance types to use for this build. The service will pick one of
  these instance types based on availability.
- `"keyPair"`: The key pair of the infrastructure configuration. This can be used to log on
  to and debug the instance used to create your image.
- `"logging"`: The logging configuration of the infrastructure configuration.
- `"resourceTags"`: The tags attached to the resource created by Image Builder.
- `"securityGroupIds"`: The security group IDs to associate with the instance used to
  customize your EC2 AMI.
- `"snsTopicArn"`: The SNS topic on which to send image build events.
- `"subnetId"`: The subnet ID to place the instance used to customize your EC2 AMI in.
- `"terminateInstanceOnFailure"`: The terminate instance on failure setting of the
  infrastructure configuration. Set to false if you want Image Builder to retain the instance
  used to configure your AMI if the build or test phase of your workflow fails.
"""
update_infrastructure_configuration(clientToken, infrastructureConfigurationArn, instanceProfileName; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/UpdateInfrastructureConfiguration", Dict{String, Any}("clientToken"=>clientToken, "infrastructureConfigurationArn"=>infrastructureConfigurationArn, "instanceProfileName"=>instanceProfileName); aws_config=aws_config)
update_infrastructure_configuration(clientToken, infrastructureConfigurationArn, instanceProfileName, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = imagebuilder("PUT", "/UpdateInfrastructureConfiguration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("clientToken"=>clientToken, "infrastructureConfigurationArn"=>infrastructureConfigurationArn, "instanceProfileName"=>instanceProfileName), params)); aws_config=aws_config)


text:
module Power
export power_method, inverse_power_method

using LinearAlgebra

"""
Calculate the dominant eigenvalue of a matrix A and its associated eigenvector.
"""
function power_method(A::Matrix{<:Real}, x::Vector{<:Real}, n::Int)::Tuple
	y = x
	m = 1

	for _ in 0:n
		y = A * x
		m = maximum(abs.(y))
		x = (m^-1)y
	end

	return (m, y)
end

"""
Calculate the least dominant eigenvalue of a matrix A and its associated
eigenvector.
"""
function inverse_power_method(A::Matrix{<:Real}, x::Vector{<:Real}, n::Int)::Tuple
	return power_method(inv(A), x, n)
end

end

ext: jl

max_stars_repo_name: severen/playground

max_issues_repo_name: severen/playground

max_forks_repo_name: severen/playground


text:
module Raw2CSV

import DelimitedFiles

# ==================== GATHERING METHODS ====================

function gather_data_from_files(
	@nospecialize(filenames), @nospecialize(extractors)
)
	file_contents = String[]
	sizehint!(file_contents, length(filenames))
	for filename in filenames
		push!(file_contents, read(filename, String))
	end
	processed_data = Any[]
	sizehint!(processed_data, length(extractors))
	for e in extractors
		push!(processed_data, map(e, file_contents))
	end
	return processed_data
end

function gather_data_from_folder(
	@nospecialize(folder_name), @nospecialize(extractors)
)
	filenames = readdir(folder_name; join = true, sort = false)
	return gather_data_from_files(filenames, extractors)
end

function _data2csv(
	@nospecialize(data), @nospecialize(delim), @nospecialize(column_names)
)
	iob = IOBuffer()
	if column_names !== missing
		println(iob, join(column_names, delim))
	end
	DelimitedFiles.writedlm(iob, zip(data...), delim)
	csv_str = read(seekstart(iob), String)
	return csv_str
end

function gather_csv_from_files(
	files :: AbstractVector{<:AbstractString},
	@nospecialize(extractors);
	delim = ';'
) :: String
	if !ismissing(column_names)
		@assert length(column_names) == length(extractors)
	end
	data = gather_data_from_files(files, extractors)
	return _data2csv(data, delim, column_names)
end

function gather_csv_from_files(
	files :: AbstractVector{<:AbstractString},
	@nospecialize(names_and_extractors :: Vector{T});
	delim = ';', column_names = missing
) :: String where {T}
	column_names = first.(names_and_extractors)
	extractors = last.(names_and_extractors)
	data = gather_data_from_files(files, extractors)
	return _data2csv(data, delim, column_names)
end

function gather_csv_from_folders(
	folders_name :: AbstractVector{<:AbstractString},
	@nospecialize(extractors);
	delim = ';', column_names = missing
) :: String where {T}
	if !ismissing(column_names)
		@assert length(column_names) == length(extractors)
	end
	data = Any[]
	for folder_name in folders_name
		push!(data, gather_data_from_folder(folder_name, extractors))
	end
	#if isone(length(data))
	#	data = only(data)
	#else
		data = map(vcat, data...)
	#end
	return _data2csv(data, delim, column_names)
end

function gather_csv_from_folders(
	folders_name :: AbstractVector{<:AbstractString},
	@nospecialize(names_and_extractors :: Vector{T});
	delim = ';'
) :: String where {T <: Tuple{String, Any}}
	column_names = first.(names_and_extractors)
	extractors = last.(names_and_extractors)
	return gather_csv_from_folders(
		folders_name, extractors; delim = delim, column_names = column_names
	)
end

function gather_csv_from_folder(
	folder_name :: AbstractString, @nospecialize(extractors);
	delim = ';', column_names = missing
) :: String
	return gather_csv_from_folders(
		[folder_name], extractors; delim = delim, column_names = column_names
	)
end

function gather_csv_from_folder(
	folder_name :: AbstractString,
	@nospecialize(names_and_extractors :: Vector{T});
	delim = ';'
) :: String where {T <: Tuple{String, Any}}
	column_names = first.(names_and_extractors)
	extractors = last.(names_and_extractors)
	return gather_csv_from_folders(
		[folder_name], extractors; delim = delim, column_names = column_names
	)
end

# ==================== MY_PARSE METHODS ====================

# An extensible parsing method.
function my_parse(::Type{String}, str :: AbstractString) :: String
	m = match(r"^\"(.*)\"$", str)
	if isnothing(m)
		return String(str)
	else
		return String(m.captures[1])
	end
end

function my_parse(::Type{N}, str :: AbstractString) :: N where {N <: Number}
	return parse(N, str)
end

# ==================== EXTRACTOR METHODS ====================

struct NoDefault{T} end

struct WrappedExtractor{F, E}
	f :: F # Anything that can be called passing the type returned by extractor.
	extractor :: E # Anything that can be called passing an AbstractString.
end

function (we::WrappedExtractor{F, E})(data :: AbstractString) where {F, E}
	return we.f(we.extractor(data))
end

function wrap(f, extractor)
	return WrappedExtractor(f, extractor)
end

function wrap(f, we :: WrappedExtractor{F, E}) where {F, E}
	return WrappedExtractor(f ∘ we.f, we.extractor)
end

struct RegexExtractor{T}
	regex :: Regex
	default :: Union{T, NoDefault{T}}
end

function (re::RegexExtractor{T})(data :: AbstractString) :: T where {T}
	m = match(re.regex, data)
	isnothing(m) || return my_parse(T, only(m.captures))
	if re.default === NoDefault{T}()
		error("The regex $(re.regex) has found no matches. No default available.")
	end
	return re.default
end

function key_equals_extractor(
	key :: AbstractString, default :: Union{T, NoDefault{T}}
) where {T}
	return RegexExtractor{T}(
		Regex("^$key = (.*)\$", "m"), default
	)
end

function key_equals(
	key :: AbstractString, default :: Union{T, NoDefault{T}}
) where {T}
	return (key, key_equals_extractor(key, default))
end

function p_args_key(
	key :: AbstractString, default :: Union{T, NoDefault{T}}
) where {T}
	return (key, p_args_key_extractor(key, default))
end

function p_args_key_extractor(
	key :: AbstractString, default :: Union{T, NoDefault{T}}
) where {T}
	return RegexExtractor{T}(
		Regex("^p_args = .*\"$key\" => ([^,)]*)", "m"), default
	)
end

struct BooleanExtractor
	regex :: Regex
	match_answer :: Bool
end

function (be::BooleanExtractor)(data :: AbstractString)
	m = match(be.regex, data)
	isnothing(m) && return !be.match_answer
	return be.match_answer
end

function matches(r :: Regex)
	return BooleanExtractor(r, true)
end

function does_not_match(r :: Regex)
	return BooleanExtractor(r, false)
end

@enum RNStat Objective=1 Iterations=2 Time=3
Base.getindex(indexable :: AbstractArray, s :: RNStat) = indexable[Int(s)]
Base.getindex(indexable :: Tuple, s :: RNStat) = indexable[Int(s)]

struct RootNodeStatsExtractor
	marker :: String
	stat :: RNStat
end

# Return the objective value, number of iterations, and the time spent
# (in seconds) in the first Gurobi log node relaxation line it finds after
# the `marker` string (the `maker` should be a full line).
function (rnse::RootNodeStatsExtractor)(
	log :: AbstractString
) :: Union{Int, Float64}
	marker = "MARK_" * rnse.marker
	# First, let us restrict the log to the part after our marker and before the
	# next marker (if there is one, otherwise until the end of the input).
	all_markers_positions = findall(r"^MARK_.+$"m, log)
	all_markers = getindex.(log, all_markers_positions)
	our_marker_idx = findfirst(isequal(marker), all_markers)
	isnothing(our_marker_idx) && return (NaN, -1, NaN)[rnse.stat]
	first_byte = first(all_markers_positions[our_marker_idx])
	if our_marker_idx == length(all_markers)
		# If it is the last marker, just go from there to the end of the string.
		final_byte = length(log)
	else
		# If it is not the last marker, get from there to the start of the next.
		# The final byte is always an 'M' character in this case.
		final_byte = first(all_markers_positions[our_marker_idx + 1])
	end
	log = log[first_byte:final_byte]
	# The presolve can remove all rows and columns in some cases, and then
	# the extraction below will fail. So we check this first, and return zero
	# values in this case (that is the most sensible value).
	presolve_regex = Regex("^Presolve: All rows and columns removed\$", "m")
	if !isnothing(match(presolve_regex, log))
		return (0.0, 0, 0.0)[rnse.stat]
	end
	# If barrier is used, the barrier log line appears first and has the most
	# accurate time. If it isn't the root relaxation line is the only one
	# present and has the correct time. Unfortunately the order of the captures
	# in this segment does not match the RNStat enum.
	barrier_log = "^Barrier solved model in (\\d+) iterations and (\\S+) " *
		"seconds\nOptimal objective (\\S+)"
	# The order of captures in the line below match the enum RNStat.
	root_rel = "^Root relaxation: (?:objective (\\S+)|cutoff), (\\d+) " *
		"iterations, (\\S+) seconds"
	either_line = "(?:$barrier_log|$root_rel)"
	r = Regex(either_line, "m")
	m = match(r, log)
	if nothing === m
		return (NaN, -1, NaN)[rnse.stat]
	else
		@assert 6 == length(m.captures)
		# If there is no barrie line.
		if isnothing(match(r"^Barrier solved model"m, m.match))
			# A capture has index i if it is the i-esim capture to appear in the
			# string, even if previous captures cannot coexist with the current
			# one (i.e., one is before a '|' inside a group and the other after).
			# This way, all non-barrier captures appear after the barrier ones,
			# even if there were no barrier section (the first three captures
			# are nothing in this case).
			@assert m.captures[[1, 2, 3]] == [nothing, nothing, nothing]
			idx = 3 + Int(rnse.stat) # The enumeration has the right order.
			# The root node relaxation can present the string 'cutoff' instead
			# of the objective value, not sure, but it seems to happen when the
			# warm-start has the same value as the relaxation rounded down. In
			# this case, the script processing the data needs to search the
			# objective value in the restricted_LP key. We will not do this
			# here.
			if rnse.stat == Objective && isnothing(m.captures[idx])
				@assert !isnothing(match(r"^Root relaxation: cutoff,"m, m.match))
				return NaN
			end
			return parse((Float64, Int, Float64)[rnse.stat], m.captures[idx])
		else # If there is a barrier line.
			@assert m.captures[[4, 5, 6]] == [nothing, nothing, nothing]
			# The enumeration has not the right order in this line.
			idx :: Int = rnse.stat == Iterations ? 1 : rnse.stat == Time ? 2 : 3
			return parse((Int, Float64, Float64)[idx], m.captures[idx])
		end
	end
end

# ==================== EXPORT EVERYTHING ====================

# Exports everything that do not start with an underscore.
const _EXCLUDE_SYMBOLS = [Symbol(@__MODULE__), :eval, :include]

for sym in names(@__MODULE__, all=true)
    sym_string = string(sym)
    if sym in _EXCLUDE_SYMBOLS || startswith(sym_string, "_") ||
         startswith(sym_string, "@_")
        continue
    end
    if !(Base.isidentifier(sym) || (startswith(sym_string, "@") &&
         Base.isidentifier(sym_string[2:end])))
       continue
    end
    @eval export $sym
end

end # module


text:
function _generate_2d_nodes!(nodes, nx, ny, LL, LR, UR, UL)
      for i in 0:ny-1
        ratio_bounds = i / (ny-1)

        x0 = LL[1] * (1 - ratio_bounds) + ratio_bounds * UL[1]
        x1 = LR[1] * (1 - ratio_bounds) + ratio_bounds * UR[1]

        y0 = LL[2] * (1 - ratio_bounds) + ratio_bounds * UL[2]
        y1 = LR[2] * (1 - ratio_bounds) + ratio_bounds * UR[2]

        for j in 0:nx-1
            ratio = j / (nx-1)
            x = x0 * (1 - ratio) + ratio * x1
            y = y0 * (1 - ratio) + ratio * y1
            push!(nodes, Node(Vec{2}((x, y))))
        end
    end
end

function _build_cells(face_idx, cells::Vector{Cell{2,N,M}}, el_nodes, el_faces,n_el, faces, facesdict,nodes) where {N,M}
    fill!(el_faces,0)
    #build faces
    for (i,fn_id) in enumerate(reference_edge_nodes(eltype(cells)))
        v1 = el_nodes[fn_id[1]]; v2 = el_nodes[fn_id[2]]
        element = minmax(v1,v2)
        token = Base.ht_keyindex2!(facesdict, element)
        if token > 0
                el_faces[i] = facesdict.vals[token]
                if n_el != faces[facesdict.vals[token],4]
                    faces[facesdict.vals[token],4] = n_el
                end
        else
            face_idx = face_idx + 1
            Base._setindex!(facesdict, face_idx, element, -token)
            faces[face_idx,1] = v1
            faces[face_idx,2] = v2
            faces[face_idx,3] = n_el
            faces[face_idx,4] = 0
            el_faces[i] = face_idx
        end
    end
    #save cell
    cell = _build_cell(eltype(cells),el_nodes,el_faces)
    push!(cells, cell)
    return face_idx
end

# Check face orientation consistency
function _check_node_data(nodes, n1,n2,n3)
    a = nodes[n2].x-nodes[n1].x
    b = nodes[n3].x-nodes[n1].x
    if (a[1]*b[2]-a[2]*b[1]) < 0
        #swap vertices 2 and 3
        return (n1,n3,n2)
    end
    return (n1,n2,n3)
end

#Boundary sets for rectangular mesh
function _get_rectangular_boundary_sets(nodes::Vector{Node{2,T}}, faces::Matrix{Int}, face_idx::Int,
    LL::Vec{2,T}, UR::Vec{2,T}, LR::Vec{2,T}, UL::Vec{2,T}) where {T}
    # Add faces and nodes sets
    # Add faces and nodes sets
    bottomSet = Set{Int}(); bottomNSet = Set{Int}()
    rightSet = Set{Int}(); rightNSet = Set{Int}()
    topSet = Set{Int}(); topNSet = Set{Int}()
    leftSet = Set{Int}(); leftNSet = Set{Int}()
    for k in 1:face_idx
        ref = 0
        if faces[k,4] == 0
            if (nodes[faces[k,1]].x[2] == LL[2] && nodes[faces[k,2]].x[2] == LL[2])
                push!(bottomSet, k); push!(bottomNSet, faces[k,1]); push!(bottomNSet, faces[k,2])
            elseif (nodes[faces[k,1]].x[1] == UR[1] && nodes[faces[k,2]].x[1] == UR[1])
                push!(rightSet, k); push!(rightNSet, faces[k,1]); push!(rightNSet, faces[k,2])
            elseif (nodes[faces[k,1]].x[2] == UR[2] && nodes[faces[k,2]].x[2] == UR[2])
                push!(topSet, k); push!(topNSet, faces[k,1]); push!(topNSet, faces[k,2])
            elseif (nodes[faces[k,1]].x[1] == LL[1] && nodes[faces[k,2]].x[1] == LL[1])
                push!(leftSet, k); push!(leftNSet, faces[k,1]); push!(leftNSet, faces[k,2])
            else
                throw("Face $k belongs to one cell but is not in boundary")
            end
        end
    end
    facesets = Dict("bottom"=>bottomSet, "right"=>rightSet,"left"=>leftSet,
                    "top"=>topSet,"boundary"=>union(bottomSet,rightSet,leftSet,topSet))
    nodesets = Dict("bottom"=>bottomNSet, "right"=>rightNSet,"left"=>leftNSet,
                    "top"=>topNSet,"boundary"=>union(bottomNSet,rightNSet,leftNSet,topNSet))
    return facesets, nodesets
end

#########################
# Triangle Cells 2D   #
#########################
@inline _build_cell(::Type{TriangleCell}, el_nodes, el_faces) = TriangleCell(el_nodes,(el_faces[1],el_faces[2],el_faces[3]))
"""
rectangle_mesh(::Type{TriangleCell}, nel::NTuple{2,Int}, LL::Vec{2,T}, UR::Vec{2,T})
Generate a rectangular mesh with triangular cells, where `LL` is the low left vertex
and `UR` is the upper right one. `nel` is a tuple with the number of partions to be
used in each dimension.
"""
@inline rectangle_mesh(::Type{TriangleCell}, nel::NTuple{2,Int}, LL::Vec{2,T}, UR::Vec{2,T}) where {T} =
        rectangle_mesh(RefTetrahedron, Val{2}, nel, LL, UR)

"""
rectangle_mesh(::Type{RefTetrahedron}, ::Type{Val{2}}, nel::NTuple{2,Int}, LL::Vec{2,T}, UR::Vec{2,T})
Generate a rectangular mesh with triangular cells, where `LL` is the low left vertex
and `UR` is the upper right one. `nel` is a tuple with the number of partions to be
used in each dimension.
"""
function rectangle_mesh(::Type{RefTetrahedron}, ::Type{Val{2}}, nel::NTuple{2,Int}, LL::Vec{2,T}, UR::Vec{2,T}) where {T}
    LR = Vec{2}((UR[1],LL[2]))
    UL = Vec{2}((LL[1],UR[2]))
    nel_x = nel[1]; nel_y = nel[2]; nel_tot = 2*nel_x*nel_y
    n_nodes_x = nel_x + 1; n_nodes_y = nel_y + 1
    n_nodes = n_nodes_x * n_nodes_y

    # Generate nodes
    nodes = Node{2,T}[]
    _generate_2d_nodes!(nodes, n_nodes_x, n_nodes_y, LL, LR, UR, UL)

    faces = Matrix{Int}(undef,nel[1]+nel[2]+3*nel[1]*nel[2],4)

    # Generate cells
    node_array = reshape(collect(1:n_nodes), (n_nodes_x, n_nodes_y))
    cells = TriangleCell[]
    facesdict = Dict{NTuple{2,Int},Int}()
    el_faces = [0,0,0]
    n_el = 0
    face_idx = 0
    for j in 1:nel_y, i in 1:nel_x
        n_el = n_el + 1
        el_nodes = _check_node_data(nodes, node_array[i,j], node_array[i+1,j], node_array[i,j+1])
        face_idx = _build_cells(face_idx, cells, el_nodes, el_faces,n_el, faces, facesdict,nodes) # ◺

        n_el = n_el + 1
        el_nodes = _check_node_data(nodes, node_array[i+1,j], node_array[i+1,j+1], node_array[i,j+1])
        face_idx = _build_cells(face_idx,cells, el_nodes, el_faces,n_el, faces, facesdict,nodes) # ◹
    end

    # Add faces sets
    facesets, nodesets = _get_rectangular_boundary_sets(nodes, faces, face_idx, LL, UR, LR, UL)
    return PolygonalMesh{2,3,3,2,T}(cells, nodes, faces, facesets, nodesets)
end

#########################
# Rectangle Cells 2D   #
#########################
@inline _build_cell(::Type{RectangleCell}, el_nodes, el_faces) = RectangleCell(el_nodes,(el_faces[1],el_faces[2],el_faces[3],el_faces[4]))
"""
rectangle_mesh(::Type{RectangleCell}, nel::NTuple{2,Int}, LL::Vec{2,T}, UR::Vec{2,T}) where {T}
Generate a rectangular mesh with triangular cells, where `LL` is the low left vertex
and `UR` is the upper right one. `nel` is a tuple with the number of partions to be
used in each dimension.
"""
function rectangle_mesh(::Type{RectangleCell}, nel::NTuple{2,Int}, LL::Vec{2,T}, UR::Vec{2,T}) where {T}
    LR = Vec{2}((UR[1],LL[2]))
    UL = Vec{2}((LL[1],UR[2]))
    nel_x = nel[1]; nel_y = nel[2]; nel_tot = 2*nel_x*nel_y
    n_nodes_x = nel_x + 1; n_nodes_y = nel_y + 1
    n_nodes = n_nodes_x * n_nodes_y

    # Generate nodes
    nodes = Node{2,T}[]
    _generate_2d_nodes!(nodes, n_nodes_x, n_nodes_y, LL, LR, UR, UL)

    faces = Matrix{Int}(undef,(nel[1]+1)*nel[2]+nel[1]*(nel[2]+1),4)

    # Generate cells
    node_array = reshape(collect(1:n_nodes), (n_nodes_x, n_nodes_y))
    cells = RectangleCell[]
    facesdict = Dict{NTuple{2,Int},Int}()
    el_faces = [0,0,0,0]
    n_el = 0
    face_idx = 0
    for j in 1:nel_y, i in 1:nel_x
        n_el = n_el + 1
        el_nodes = (node_array[i,j], node_array[i+1,j], node_array[i+1,j+1], node_array[i,j+1])
        face_idx = _build_cells(face_idx, cells, el_nodes, el_faces,n_el, faces, facesdict,nodes)
    end

    # Add faces and nodes sets
    facesets, nodesets = _get_rectangular_boundary_sets(nodes, faces, face_idx, LL, UR, LR, UL)
    return PolygonalMesh{2,4,4,2,T}(cells, nodes, faces, facesets, nodesets)
end


text:
"""
    trajectory_flow(vectorfield, r0, parameters)
Integrates the equation of motion of a given vector field with the integrator passed through the parameters.
"""
function trajectory_flow(field::Function, r0::Vector{Float64}, p::Parameters)
    method = p.integrator.f
    t = 0.0:p.dt:p.nsteps*p.dt

    function extendedfield(time::Float64, r::Vector{Float64})
        field(r, p.potential, 1/p.T, p.thermo)
    end

    pos = [zeros(3), zeros(3)] #Initialize pos array with the correct type

    try
        t,pos = method(extendedfield, r0, t, points=:specified)
    catch
        t,pos = method(extendedfield, r0, t)
    end

    sample = round(Int,p.dtsampling/p.dt)
    return t[1:sample:end], pos[1:sample:end]

end

"""
Return the results of the simulation. Basically, the results are of two types: either the lyapunov spectra for a certain number of random initial conditions or the points belonging to the trajectory defined by a random initial condition.
"""
function trajectory_simulation(p::Parameters, r0::Vector{Float64})
    (t, xsol) = trajectory_flow(DDfield, r0, p)
    x = map(v -> v[1], xsol)
    y = map(v -> v[2], xsol)
    z = map(v -> v[3], xsol)
    tx = [t x y z]
    return tx
end

max_stars_repo_name: dapias/STODs

max_issues_repo_name: dapias/STODs

max_forks_repo_name: dapias/STODs


text:
using ChaosTools
using Test
using Random

ν_thresh_lower, ν_thresh_upper = 0.1, 0.9
C_thresh_lower, C_thresh_upper = 0.15, 0.9

println("\nTesting Partially predictable chaos...")

@testset "Predictability Lorenz" begin
    @testset "strongly chaotic" begin
        Random.seed!(12)
        lz = Systems.lorenz(ρ=180.70)
        @time chaos_type, ν, C = predictability(lz;
            λ_max = 1.22, maxiters=1e9, T_max = 1e3, n_samples = 100,
        )
        @test chaos_type == :SC
        @test ν < ν_thresh_lower
        @test C < C_thresh_lower
        println("strongly chaotic: done")
    end
    @testset "PPC 1" begin
        Random.seed!(12)
        lz = Systems.lorenz(ρ=180.78)
        @time chaos_type, ν, C = predictability(lz;
            λ_max = 0.4, maxiters=1e9, n_samples = 100, T_max = 400
        )
        @test chaos_type == :PPC
        @test ν < ν_thresh_lower
        @test C > C_thresh_upper
        println("ppc1: done")
    end
    @testset "PPC 2" begin
        Random.seed!(12)
        lz = Systems.lorenz(ρ=180.95)
        @time chaos_type, ν, C = predictability(lz;
            λ_max = 0.1, maxiters=1e9, n_samples = 100, T_max = 400
        )
        @test chaos_type == :PPC
        @test ν < ν_thresh_lower
        @test C > C_thresh_upper
        println("ppc2: done")
    end
    @testset "laminar" begin
        Random.seed!(12)
        lz = Systems.lorenz(ρ=181.10)
        @time chaos_type, ν, C = predictability(lz;
            λ_max = 0.01, T_max = 400, n_samples = 100, maxiters=1e9
        )
        @test chaos_type == :REG
        @test ν > ν_thresh_upper
        @test C > C_thresh_upper
        println("laminar: done")
    end
end

@testset "Predictability Discrete" begin
    @testset "Henon map" begin
        ds = Systems.henon()
        a_reg = 0.8; a_ppc = 1.11; a_reg2 = 1.0; a_cha = 1.4
        res = [:REG, :REG, :PPC, :SC]

        for (i, a) in enumerate((a_reg, a_reg2, a_ppc, a_cha))
            set_parameter!(ds, 1, a)
            chaos_type, ν, C = predictability(ds; T_max = 100000)
            @test chaos_type == res[i]
        end
    end
end


text:
export p_speed
export far_field_pattern, pair_field_pattern, diff_far_field_pattern
export wavenumber_challis, one_species_low_wavenumber,
        two_species_approx_wavenumber
export wienerhopf_reflection_coefficient, wienerhopf_mode_amplitudes

include("acoustic_mediums.jl")

include("low_frequency.jl")

include("effective_wave/asymptotics.jl")

include("effective_wave/planewaves/eigensystem.jl")
include("effective_wave/planewaves/material_scattering_coefficients.jl")
include("effective_wave/planewaves/boundary_condition.jl")
# include("effective_wave/planewaves/wavemode-wienerhopf.jl")

# regular means a smooth field assumption and includes cases such as a sphere filled with particles.
include("effective_wave/regular/eigensystem.jl")
include("effective_wave/regular/boundary_condition.jl")
include("effective_wave/regular/material_scattering_coefficients.jl")

include("effective_wave/far_fields.jl")
include("effective_wave/low_volumefraction.jl")
include("effective_wave/alternative_wavenumbers.jl")
include("effective_wave/two_species_approximate.jl")

include("discrete_wave/export.jl")

max_stars_repo_name: arturgower/EffectiveWaves


text:
xml_stfile  = path*"/SampleFiles/XML/fdsnws-station_2017-01-12T03-17-42Z.xml"
xml_stpat   = path*"/SampleFiles/XML/fdsnws-station*"
f_out       = "test.xml"

id_err    = "error in Station ID creation!"
unit_err  = "units don't match instrument code!"
true_id   = String["3337497", "3279407", "2844986", "2559759", "2092067", "1916079", "2413"]
true_ot   = DateTime("2011-03-11T05:46:23.200")
true_loc  = Float64[2.2376 38.2963; 93.0144 142.498; 26.3 19.7]
true_mag  = Float32[8.6, 9.1, 8.8, 8.5, 8.6, 9.0, 8.5]
true_msc  = String["MW", "MW", "MW", "MW", "MW", "MW", ""]
r1 = PZResp(a0 = 2.45956f13, f0 = 0.02f0, p = ComplexF32[-981.0+1009.0im, -981.0-1009.0im, -3290.0+1263.0im, -3290.0-1263.0im])
r2 = PZResp(Complex{Float32}.([   0.0+0.0im       -0.037-0.037im
                                  0.0+0.0im       -0.037+0.037im
                                  -15.15+0.0im    -15.64+0.0im
                                  -176.6+0.0im    -97.34-400.7im
                                  -463.1-430.5im  -97.34+400.7im
                                  -463.1+430.5im  -374.8+0.0im
                                  0.0+0.0im       -520.3+0.0im
                                  0.0+0.0im       -10530.0-10050.0im
                                  0.0+0.0im       -10530.0+10050.0im
                                  0.0+0.0im       -13300.0+0.0im
                                  0.0+0.0im       -255.097+0.0im ]),rev=true)
r2.z  = r2.z[1:6]
r2.f0 = 0.02f0
r2.a0 = 3.53734f17

printstyled("  FDSN station XML\n", color=:light_green)
io = open(xml_stfile, "r")
xsta = read(io, String)
close(io)

S = FDSN_sta_xml(xsta, false, "0001-01-01T00:00:00", "9999-12-31T23:59:59", 0)
ID = S.id
NAME = S.name
LOC = S.loc
FS = S.fs
GAIN = S.gain
RESP = S.resp
UNITS = S.units
MISC = S.misc

@assert(ID[1]=="AK.ATKA..BNE", id_err)
@assert(ID[2]=="AK.ATKA..BNN", id_err)
@assert(ID[end-1]=="IU.MIDW.01.BHN", id_err)
@assert(ID[end]=="IU.MIDW.01.BHZ", id_err)
@test ==(LOC[1], GeoLoc(lat=52.2016, lon=-174.1975, el=55.0, az=90.0, inc=-90.0))
@test ≈(LOC[3].lat, LOC[1].lat)
@test ≈(LOC[3].lon, LOC[1].lon)
@test ≈(LOC[3].dep, LOC[1].dep)
for i = 1:length(UNITS)
    if UNITS[i] == "m/s2"
        @assert(in(split(ID[i],'.')[4][2],['G', 'L', 'M', 'N'])==true, unit_err)
    elseif UNITS[i] in ["m/s", "m"]
        @assert(in(split(ID[i],'.')[4][2],['L', 'H'])==true, unit_err)
    elseif UNITS[i] == "v"
        @assert(split(ID[i],'.')[4][2]=='C', unit_err)
    end
end
@test ≈(GAIN[1], 283255.0)
@test ≈(GAIN[2], 284298.0)
@test ≈(GAIN[end-1], 8.38861E9)
@test ≈(GAIN[end], 8.38861E9)
@test RESP[1] == RESP[2] == r1
@test RESP[end-1] == RESP[end] == r2

# xdoc = LightXML.parse_string(xsta); xroot = LightXML.root(xdoc); xnet = child_elements(xroot);
# xr = get_elements_by_tagname(get_elements_by_tagname(get_elements_by_tagname(get_elements_by_tagname(xroot, "Network")[1], "Station")[1], "Channel")[1], "Response")[1];
# stage = get_elements_by_tagname(xr, "Stage");
printstyled("    with MultiStageResp\n", color=:light_green)
S = FDSN_sta_xml(xsta, true, "0001-01-01T00:00:00", "9999-12-31T23:59:59", 0)
r = S.resp[1]
for f in fieldnames(MultiStageResp)
  @test length(getfield(r,f)) == 9
end
@test r.stage[3].b[1:3] == [0.000244141, 0.000976562, 0.00244141]
@test r.fs[6] == 8000.0
@test r.fac[6] == 2
@test r.delay[6] == 7.5E-4
@test r.corr[6] == 7.5E-4
@test r.stage[9].b[6:9] == [-0.0000000298023, -0.0000000298023, -0.0000000298023, 0.0]
@test r.stage[9].a == []

printstyled("    read_sxml\n", color=:light_green)
S = read_sxml(xml_stfile, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, false, 0)
T = read_sxml(xml_stpat, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, false, 0)
@assert T.n > S.n
@test findid(T.id[S.n+1], S.id) == 0
@test_throws ErrorException read_sxml("nonexist.txt", "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, false, 0)

printstyled("    read_meta\n", color=:light_green)
S = read_meta("sxml", xml_stfile)
T = read_meta("sxml", xml_stpat)
@assert T.n > S.n
@test findid(T.id[S.n+1], S.id) == 0

printstyled("    overwrite channel headers on time match\n", color=:light_green)
redirect_stdout(out) do
  xml_stfile = path*"/SampleFiles/XML/fdsnws-station_2017-01-12T03-17-42Z.xml"
  S = SeisData()
  read_station_xml!(S, xml_stfile, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, 3)
  n = S.n
  read_station_xml!(S, xml_stfile, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, 3)
  @test S.n == n
  S = read_station_xml(xml_stfile, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, 0)
end

# XML writer
printstyled("    write_sxml\n", color=:light_green)
S = randSeisData(12)
S.id[1] = "CC.VALT..BHZ"
S.id[2] = "CC.VALT..BHE"
S.id[3] = "YY.FAIL"
S.name[2] = S.name[1]
write_sxml(f_out, S)
Sr = read_sxml(f_out, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, false, 0)
sort!(S)
sort!(Sr)
for i in 1:S.n
  for f in (:name, :fs, :gain, :units)
    @test getfield(S, f)[i] == getfield(Sr, f)[i]
  end
  @test S.id[i]*(S.id[i] == "YY.FAIL" ? ".." : "") == Sr.id[i]
  if typeof(S.resp[i]) in (PZResp, PZResp64, MultiStageResp)
    if typeof(S.resp[i]) == PZResp64
      R = S.resp[i]
      S.resp[i] = PZResp(a0 = Float32(R.a0), f0 = Float32(R.f0),
        p = ComplexF32.(R.p), z = ComplexF32.(R.z))
    end
    @test S.resp[i] == Sr.resp[i]
  end
  if typeof(S.loc[i]) == GeoLoc
    for f in (:lat, :lon, :el, :dep, :az, :inc)
      @test getfield(S.loc[i],f) ≈ getfield(Sr.loc[i],f)
    end
  end
end
write_sxml(f_out, breaking_seis())

printstyled("      check that output of write_sxml is re-read identically\n", color=:light_green)
files = ls(xml_stpat)
for file in files
  S = read_sxml(file, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, true, 0)
  write_sxml(f_out, S)
  Sr = read_sxml(f_out, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, true, 0)
  sort!(S)
  sort!(Sr)

  for f in datafields
    (f in (:id, :src, :notes)) && continue
    @test getfield(S,f) == getfield(Sr,f)
  end
end
try
  rm(f_out)
catch err
  @warn(string("Can't remove ", f_out, ": throws error ", err))
end

printstyled("      checking channel list handling\n", color=:light_green)
file = files[2]
chans = 21:40
S = read_sxml(file, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, true, 0)
write_sxml(f_out, S, chans=chans)
S1 = S[chans]
sort!(S1)
Sr = read_sxml(f_out, "0001-01-01T00:00:00", "9999-12-31T23:59:59", false, true, 0)
sort!(Sr)
for f in datafields
  (f in (:id, :src, :notes)) && continue
  @test getfield(S1,f) == getfield(Sr,f)
end

printstyled("      extension to GphysChannel\n", color=:light_green)
write_sxml(f_out, S[1])


text:
# Test partitioning
d = 1
limits = repeat([0.0 1.0], d, 1)
P = Partition(limits)
split!(P, 1, 1)
@test_throws(ArgumentError("P does not contain a subregion at index 3"), split!(P, 3, 1))
@test_throws(ArgumentError("P is not 2-dimensional"), split!(P, 1, 2))
@test P.regions[1] == [0.0 0.5]
@test P.regions[2] == [0.5 1.0]
@test locate(P, [0.0 0.5 1.0]) == [1, 2, 2]
@test_throws(ArgumentError("no region located for observation 2"), locate(P, [0.0 1.1]))
@test_throws(
    DimensionMismatch("P does match the dimension of X"), locate(P, [0.0 0.0; 0.0 0.0])
)

# Test variable selection
d, n = 10, 1000
g(x) = 4 * x[5] - 10 * x[10] + x[2]
X, y = NonlinearBandits.gaussian_data(d, n, g)
@test lasso_selection(X, y, 2, false) == [5, 10]
@test lasso_selection(X, y, 2, true) == [1, 10]

# Set up a truly partitioned polynomial target function
d, n = 3, 10000
Jvals = [2, 3] # Degrees for left and right regions
basis = [tpbasis(d, J) for J in Jvals]
β = [rand(Normal(0, 10), length(basis[i]), 1) for i in 1:length(Jvals)]
limits = repeat([0.0 1.0], d, 1)
P = Partition(limits)
split!(P, 1, 1)

function f(x)
    # Sparse basis is used to test lasso selection
    x = reshape(x, (:, 1))
    k = locate(P, x)[1]
    z = expand(x, basis[k], P.regions[k]; J=Jvals[k])
    return (z' * β[k])[1, 1]
end

X, y = NonlinearBandits.gaussian_data(d, n, f; σ=0.5)
pbpm = PartitionedBayesPM(X, y, limits; verbose=false);
@test pbpm.P.regions == P.regions
@test mae(pbpm.models[1].lm.β, β[1]) < 0.1
@test mae(pbpm.models[2].lm.β, β[2]) < 0.1

@test_throws(
    ArgumentError("X and limits don't match in their first dimension"),
    PartitionedBayesPM(X[1:2, :], y, limits; verbose=false)
)
@test_throws(
    ArgumentError("Jmax must be non-negative"),
    PartitionedBayesPM(X, y, limits; Jmax=-1, verbose=false)
)
@test_throws(
    ArgumentError("Kmax must be strictly positive"),
    PartitionedBayesPM(X, y, limits; Kmax=0, verbose=false)
)
@test_throws(
    ArgumentError("tolerance must be non-negative"),
    PartitionedBayesPM(X, y, limits; tol=-1.0)
)

# Test manual partitioned model setup
function g(x)
    x = reshape(x, (:, 1))
    k = locate(P, x)[1]
    z = expand(x, basis[k], P.regions[k]; J=Jvals[k])
    return (z' * β[k])[1, 1]
end

X, y = NonlinearBandits.gaussian_data(d, n, g; σ=0.5)
manual_pbpm = PartitionedBayesPM(P, Jvals)
fit!(manual_pbpm, X, y)
@test mae(manual_pbpm.models[1].lm.β, β[1]) < 0.1
@test mae(manual_pbpm.models[2].lm.β, β[2]) < 0.1
@test_throws(
    ArgumentError("must supply a value of J for every region in P"),
    PartitionedBayesPM(P, [1])
)

@test mae(manual_pbpm(X), mapslices(g, X; dims=1)) < 0.1

sequential_ppm = PartitionedBayesPM(P, Jvals)
for i in 1:size(X, 2)
    fit!(sequential_ppm, X[:, i:i], y[:, i:i])
end
@test sequential_ppm.shape == 0.001 + size(X, 2) / 2
@test sequential_ppm.scale ≈ manual_pbpm.scale


text:
# This file was generated, do not modify it. # hide
rms(y_wind[test], y_hat)


text:
"Poor (fast) man's Cassette"
module Ctx

using Base.Threads

export ctxapl

const GLOBALCTX = []

function setctx!(key, value; id = Threads.threadid())
  GLOBALCTX[id][key] = value
end

"Get the context (for this thread"
function getctx(key; id = Threads.threadid())
  GLOBALCTX[id][key]
end

"""
Contextual function application

`ctxapl(ctx, f, x1, x2, ...)`

evaluates `f(x1, x2, ...) in some context `ctx`.

This serves a similar purpose to `overdub` in the Cassette module,
except that sometimes we can use more efficient methods
"""
function ctxapl end

end