text:
#==============================================================================#
# Snowball.jl
#
# This file is generated from:
# https://github.com/aws/aws-sdk-js/blob/master/apis/snowball-2016-06-30.normal.json
#==============================================================================#

__precompile__()

module Snowball

using AWSCore

"""
    using AWSSDK.Snowball.cancel_cluster
    cancel_cluster([::AWSConfig], arguments::Dict)
    cancel_cluster([::AWSConfig]; ClusterId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "CancelCluster", arguments::Dict)
    snowball([::AWSConfig], "CancelCluster", ClusterId=)

# CancelCluster Operation

Cancels a cluster job. You can only cancel a cluster job while it's in the `AwaitingQuorum` status. You'll have at least an hour after creating a cluster job to cancel it.

# Arguments

## `ClusterId = ::String` -- *Required*
The 39-character ID for the cluster that you want to cancel, for example `CID123e4567-e89b-12d3-a456-426655440000`.

# Returns

`CancelClusterResult`

# Exceptions

`KMSRequestFailedException`, `InvalidJobStateException` or `InvalidResourceException`.

# Example: To cancel a cluster job

This operation cancels a cluster job. You can only cancel a cluster job while it's in the AwaitingQuorum status.

Input:
```
[
    "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000"
]
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/CancelCluster)
"""
@inline cancel_cluster(aws::AWSConfig=default_aws_config(); args...) = cancel_cluster(aws, args)

@inline cancel_cluster(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "CancelCluster", args)

@inline cancel_cluster(args) = cancel_cluster(default_aws_config(), args)

"""
    using AWSSDK.Snowball.cancel_job
    cancel_job([::AWSConfig], arguments::Dict)
    cancel_job([::AWSConfig]; JobId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "CancelJob", arguments::Dict)
    snowball([::AWSConfig], "CancelJob", JobId=)

# CancelJob Operation

Cancels the specified job. You can only cancel a job before its `JobState` value changes to `PreparingAppliance`. Requesting the `ListJobs` or `DescribeJob` action returns a job's `JobState` as part of the response element data returned.

# Arguments

## `JobId = ::String` -- *Required*
The 39-character job ID for the job that you want to cancel, for example `JID123e4567-e89b-12d3-a456-426655440000`.

# Returns

`CancelJobResult`

# Exceptions

`InvalidResourceException`, `InvalidJobStateException` or `KMSRequestFailedException`.

# Example: To cancel a job for a Snowball device

This operation cancels a job. You can only cancel a job before its JobState value changes to PreparingAppliance.

Input:
```
[
    "JobId" => "JID123e4567-e89b-12d3-a456-426655440000"
]
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/CancelJob)
"""
@inline cancel_job(aws::AWSConfig=default_aws_config(); args...) = cancel_job(aws, args)

@inline cancel_job(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "CancelJob", args)

@inline cancel_job(args) = cancel_job(default_aws_config(), args)

"""
    using AWSSDK.Snowball.create_address
    create_address([::AWSConfig], arguments::Dict)
    create_address([::AWSConfig]; Address=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "CreateAddress", arguments::Dict)
    snowball([::AWSConfig], "CreateAddress", Address=)

# CreateAddress Operation

Creates an address for a Snowball to be shipped to. In most regions, addresses are validated at the time of creation. The address you provide must be located within the serviceable area of your region. If the address is invalid or unsupported, then an exception is thrown.

# Arguments

## `Address = [ ... ]` -- *Required*
The address that you want the Snowball shipped to.
```
 Address = [
        "AddressId" =>  ::String,
        "Name" =>  ::String,
        "Company" =>  ::String,
        "Street1" =>  ::String,
        "Street2" =>  ::String,
        "Street3" =>  ::String,
        "City" =>  ::String,
        "StateOrProvince" =>  ::String,
        "PrefectureOrDistrict" =>  ::String,
        "Landmark" =>  ::String,
        "Country" =>  ::String,
        "PostalCode" =>  ::String,
        "PhoneNumber" =>  ::String,
        "IsRestricted" =>  ::Bool
    ]
```

# Returns

`CreateAddressResult`

# Exceptions

`InvalidAddressException` or `UnsupportedAddressException`.

# Example: To create an address for a job

This operation creates an address for a job. Addresses are validated at the time of creation. The address you provide must be located within the serviceable area of your region. If the address is invalid or unsupported, then an exception is thrown.

Input:
```
[
    "Address" => [
        "City" => "Seattle",
        "Company" => "My Company's Name",
        "Country" => "USA",
        "Name" => "My Name",
        "PhoneNumber" => "425-555-5555",
        "PostalCode" => "98101",
        "StateOrProvince" => "WA",
        "Street1" => "123 Main Street"
    ]
]
```

Output:
```
Dict(
    "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/CreateAddress)
"""
@inline create_address(aws::AWSConfig=default_aws_config(); args...) = create_address(aws, args)

@inline create_address(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "CreateAddress", args)

@inline create_address(args) = create_address(default_aws_config(), args)

"""
    using AWSSDK.Snowball.create_cluster
    create_cluster([::AWSConfig], arguments::Dict)
    create_cluster([::AWSConfig]; JobType=, Resources=, AddressId=, RoleARN=, ShippingOption=, <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "CreateCluster", arguments::Dict)
    snowball([::AWSConfig], "CreateCluster", JobType=, Resources=, AddressId=, RoleARN=, ShippingOption=, <keyword arguments>)

# CreateCluster Operation

Creates an empty cluster. Each cluster supports five nodes. You use the [CreateJob](@ref) action separately to create the jobs for each of these nodes. The cluster does not ship until these five node jobs have been created.

# Arguments

## `JobType = "IMPORT", "EXPORT" or "LOCAL_USE"` -- *Required*
The type of job for this cluster. Currently, the only job type supported for clusters is `LOCAL_USE`.

## `Resources = [ ... ]` -- *Required*
The resources associated with the cluster job. These resources include Amazon S3 buckets and optional AWS Lambda functions written in the Python language.
```
 Resources = [
        "S3Resources" =>  [[
            "BucketArn" =>  ::String,
            "KeyRange" =>  [
                "BeginMarker" =>  ::String,
                "EndMarker" =>  ::String
            ]
        ], ...],
        "LambdaResources" =>  [[
            "LambdaArn" =>  ::String,
            "EventTriggers" =>  [["EventResourceARN" =>  ::String], ...]
        ], ...],
        "Ec2AmiResources" =>  [[
            "AmiId" => <required> ::String,
            "SnowballAmiId" =>  ::String
        ], ...]
    ]
```

## `Description = ::String`
An optional description of this specific cluster, for example `Environmental Data Cluster-01`.

## `AddressId = ::String` -- *Required*
The ID for the address that you want the cluster shipped to.

## `KmsKeyARN = ::String`
The `KmsKeyARN` value that you want to associate with this cluster. `KmsKeyARN` values are created by using the [CreateKey](http://docs.aws.amazon.com/kms/latest/APIReference/API_CreateKey.html) API action in AWS Key Management Service (AWS KMS).

## `RoleARN = ::String` -- *Required*
The `RoleARN` that you want to associate with this cluster. `RoleArn` values are created by using the [CreateRole](http://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html) API action in AWS Identity and Access Management (IAM).

## `SnowballType = "STANDARD" or "EDGE"`
The type of AWS Snowball device to use for this cluster. Currently, the only supported device type for cluster jobs is `EDGE`.

## `ShippingOption = "SECOND_DAY", "NEXT_DAY", "EXPRESS" or "STANDARD"` -- *Required*
The shipping speed for each node in this cluster. This speed doesn't dictate how soon you'll get each Snowball Edge device, rather it represents how quickly each device moves to its destination while in transit. Regional shipping speeds are as follows:

*   In Australia, you have access to express shipping. Typically, devices shipped express are delivered in about a day.

*   In the European Union (EU), you have access to express shipping. Typically, Snowball Edges shipped express are delivered in about a day. In addition, most countries in the EU have access to standard shipping, which typically takes less than a week, one way.

*   In India, Snowball Edges are delivered in one to seven days.

*   In the US, you have access to one-day shipping and two-day shipping.

## `Notification = [ ... ]`
The Amazon Simple Notification Service (Amazon SNS) notification settings for this cluster.
```
 Notification = [
        "SnsTopicARN" =>  ::String,
        "JobStatesToNotify" =>  ["New", "PreparingAppliance", "PreparingShipment", "InTransitToCustomer", "WithCustomer", "InTransitToAWS", "WithAWS", "InProgress", "Complete", "Cancelled", "Listing" or "Pending", ...],
        "NotifyAll" =>  ::Bool
    ]
```

## `ForwardingAddressId = ::String`
The forwarding address ID for a cluster. This field is not supported in most regions.

# Returns

`CreateClusterResult`

# Exceptions

`InvalidResourceException`, `KMSRequestFailedException`, `InvalidInputCombinationException` or `Ec2RequestFailedException`.

# Example: To create a cluster

Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob action separately to create the jobs for each of these nodes. The cluster does not ship until these five node jobs have been created.

Input:
```
[
    "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
    "Description" => "MyCluster",
    "JobType" => "LOCAL_USE",
    "KmsKeyARN" => "arn:aws:kms:us-east-1:123456789012:key/abcd1234-12ab-34cd-56ef-123456123456",
    "Notification" => [
        "JobStatesToNotify" => [

        ],
        "NotifyAll" => false
    ],
    "Resources" => [
        "S3Resources" => [
            [
                "BucketArn" => "arn:aws:s3:::MyBucket",
                "KeyRange" => [

                ]
            ]
        ]
    ],
    "RoleARN" => "arn:aws:iam::123456789012:role/snowball-import-S3-role",
    "ShippingOption" => "SECOND_DAY",
    "SnowballType" => "EDGE"
]
```

Output:
```
Dict(
    "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000"
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/CreateCluster)
"""
@inline create_cluster(aws::AWSConfig=default_aws_config(); args...) = create_cluster(aws, args)

@inline create_cluster(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "CreateCluster", args)

@inline create_cluster(args) = create_cluster(default_aws_config(), args)

"""
    using AWSSDK.Snowball.create_job
    create_job([::AWSConfig], arguments::Dict)
    create_job([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "CreateJob", arguments::Dict)
    snowball([::AWSConfig], "CreateJob", <keyword arguments>)

# CreateJob Operation

Creates a job to import or export data between Amazon S3 and your on-premises data center. Your AWS account must have the right trust policies and permissions in place to create a job for Snowball. If you're creating a job for a node in a cluster, you only need to provide the `clusterId` value; the other job attributes are inherited from the cluster.

# Arguments

## `JobType = "IMPORT", "EXPORT" or "LOCAL_USE"`
Defines the type of job that you're creating.

## `Resources = [ ... ]`
Defines the Amazon S3 buckets associated with this job.

With `IMPORT` jobs, you specify the bucket or buckets that your transferred data will be imported into.

With `EXPORT` jobs, you specify the bucket or buckets that your transferred data will be exported from. Optionally, you can also specify a `KeyRange` value. If you choose to export a range, you define the length of the range by providing either an inclusive `BeginMarker` value, an inclusive `EndMarker` value, or both. Ranges are UTF-8 binary sorted.
```
 Resources = [
        "S3Resources" =>  [[
            "BucketArn" =>  ::String,
            "KeyRange" =>  [
                "BeginMarker" =>  ::String,
                "EndMarker" =>  ::String
            ]
        ], ...],
        "LambdaResources" =>  [[
            "LambdaArn" =>  ::String,
            "EventTriggers" =>  [["EventResourceARN" =>  ::String], ...]
        ], ...],
        "Ec2AmiResources" =>  [[
            "AmiId" => <required> ::String,
            "SnowballAmiId" =>  ::String
        ], ...]
    ]
```

## `Description = ::String`
Defines an optional description of this specific job, for example `Important Photos 2016-08-11`.

## `AddressId = ::String`
The ID for the address that you want the Snowball shipped to.

## `KmsKeyARN = ::String`
The `KmsKeyARN` that you want to associate with this job. `KmsKeyARN`s are created using the [CreateKey](http://docs.aws.amazon.com/kms/latest/APIReference/API_CreateKey.html) AWS Key Management Service (KMS) API action.

## `RoleARN = ::String`
The `RoleARN` that you want to associate with this job. `RoleArn`s are created using the [CreateRole](http://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html) AWS Identity and Access Management (IAM) API action.

## `SnowballCapacityPreference = "T50", "T80", "T100" or "NoPreference"`
If your job is being created in one of the US regions, you have the option of specifying what size Snowball you'd like for this job. In all other regions, Snowballs come with 80 TB in storage capacity.

## `ShippingOption = "SECOND_DAY", "NEXT_DAY", "EXPRESS" or "STANDARD"`
The shipping speed for this job. This speed doesn't dictate how soon you'll get the Snowball, rather it represents how quickly the Snowball moves to its destination while in transit. Regional shipping speeds are as follows:

*   In Australia, you have access to express shipping. Typically, Snowballs shipped express are delivered in about a day.

*   In the European Union (EU), you have access to express shipping. Typically, Snowballs shipped express are delivered in about a day. In addition, most countries in the EU have access to standard shipping, which typically takes less than a week, one way.

*   In India, Snowballs are delivered in one to seven days.

*   In the US, you have access to one-day shipping and two-day shipping.

## `Notification = [ ... ]`
Defines the Amazon Simple Notification Service (Amazon SNS) notification settings for this job.
```
 Notification = [
        "SnsTopicARN" =>  ::String,
        "JobStatesToNotify" =>  ["New", "PreparingAppliance", "PreparingShipment", "InTransitToCustomer", "WithCustomer", "InTransitToAWS", "WithAWS", "InProgress", "Complete", "Cancelled", "Listing" or "Pending", ...],
        "NotifyAll" =>  ::Bool
    ]
```

## `ClusterId = ::String`
The ID of a cluster. If you're creating a job for a node in a cluster, you need to provide only this `clusterId` value. The other job attributes are inherited from the cluster.

## `SnowballType = "STANDARD" or "EDGE"`
The type of AWS Snowball device to use for this job. Currently, the only supported device type for cluster jobs is `EDGE`.

## `ForwardingAddressId = ::String`
The forwarding address ID for a job. This field is not supported in most regions.

# Returns

`CreateJobResult`

# Exceptions

`InvalidResourceException`, `KMSRequestFailedException`, `InvalidInputCombinationException`, `ClusterLimitExceededException` or `Ec2RequestFailedException`.

# Example: To create a job

Creates a job to import or export data between Amazon S3 and your on-premises data center. Your AWS account must have the right trust policies and permissions in place to create a job for Snowball. If you're creating a job for a node in a cluster, you only need to provide the clusterId value; the other job attributes are inherited from the cluster.

Input:
```
[
    "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
    "Description" => "My Job",
    "JobType" => "IMPORT",
    "KmsKeyARN" => "arn:aws:kms:us-east-1:123456789012:key/abcd1234-12ab-34cd-56ef-123456123456",
    "Notification" => [
        "JobStatesToNotify" => [

        ],
        "NotifyAll" => false
    ],
    "Resources" => [
        "S3Resources" => [
            [
                "BucketArn" => "arn:aws:s3:::MyBucket",
                "KeyRange" => [

                ]
            ]
        ]
    ],
    "RoleARN" => "arn:aws:iam::123456789012:role/snowball-import-S3-role",
    "ShippingOption" => "SECOND_DAY",
    "SnowballCapacityPreference" => "T80",
    "SnowballType" => "STANDARD"
]
```

Output:
```
Dict(
    "JobId" => "JID123e4567-e89b-12d3-a456-426655440000"
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/CreateJob)
"""
@inline create_job(aws::AWSConfig=default_aws_config(); args...) = create_job(aws, args)

@inline create_job(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "CreateJob", args)

@inline create_job(args) = create_job(default_aws_config(), args)

"""
    using AWSSDK.Snowball.describe_address
    describe_address([::AWSConfig], arguments::Dict)
    describe_address([::AWSConfig]; AddressId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "DescribeAddress", arguments::Dict)
    snowball([::AWSConfig], "DescribeAddress", AddressId=)

# DescribeAddress Operation

Takes an `AddressId` and returns specific details about that address in the form of an `Address` object.

# Arguments

## `AddressId = ::String` -- *Required*
The automatically generated ID for a specific address.

# Returns

`DescribeAddressResult`

# Exceptions

`InvalidResourceException`.

# Example: To describe an address for a job

This operation describes an address for a job.

Input:
```
[
    "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b"
]
```

Output:
```
Dict(
    "Address" => Dict(
        "AddressId" => "ADID5643ec50-3eec-4eb3-9be6-9374c10eb51b",
        "City" => "Seattle",
        "Company" => "My Company",
        "Country" => "US",
        "Name" => "My Name",
        "PhoneNumber" => "425-555-5555",
        "PostalCode" => "98101",
        "StateOrProvince" => "WA",
        "Street1" => "123 Main Street"
    )
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/DescribeAddress)
"""
@inline describe_address(aws::AWSConfig=default_aws_config(); args...) = describe_address(aws, args)

@inline describe_address(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "DescribeAddress", args)

@inline describe_address(args) = describe_address(default_aws_config(), args)

"""
    using AWSSDK.Snowball.describe_addresses
    describe_addresses([::AWSConfig], arguments::Dict)
    describe_addresses([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "DescribeAddresses", arguments::Dict)
    snowball([::AWSConfig], "DescribeAddresses", <keyword arguments>)

# DescribeAddresses Operation

Returns a specified number of `ADDRESS` objects. Calling this API in one of the US regions will return addresses from the list of all addresses associated with this account in all US regions.

# Arguments

## `MaxResults = ::Int`
The number of `ADDRESS` objects to return.

## `NextToken = ::String`
HTTP requests are stateless. To identify what object comes "next" in the list of `ADDRESS` objects, you have the option of specifying a value for `NextToken` as the starting point for your list of returned addresses.

# Returns

`DescribeAddressesResult`

# Exceptions

`InvalidResourceException` or `InvalidNextTokenException`.

# Example: To describe all the addresses you've created for AWS Snowball

This operation describes all the addresses that you've created for AWS Snowball. Calling this API in one of the US regions will return addresses from the list of all addresses associated with this account in all US regions.

Input:
```
[

]
```

Output:
```
Dict(
    "Addresses" => [
        Dict(
            "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
            "City" => "Seattle",
            "Company" => "My Company",
            "Country" => "US",
            "Name" => "My Name",
            "PhoneNumber" => "425-555-5555",
            "PostalCode" => "98101",
            "StateOrProvince" => "WA",
            "Street1" => "123 Main Street"
        )
    ]
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/DescribeAddresses)
"""
@inline describe_addresses(aws::AWSConfig=default_aws_config(); args...) = describe_addresses(aws, args)

@inline describe_addresses(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "DescribeAddresses", args)

@inline describe_addresses(args) = describe_addresses(default_aws_config(), args)

"""
    using AWSSDK.Snowball.describe_cluster
    describe_cluster([::AWSConfig], arguments::Dict)
    describe_cluster([::AWSConfig]; ClusterId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "DescribeCluster", arguments::Dict)
    snowball([::AWSConfig], "DescribeCluster", ClusterId=)

# DescribeCluster Operation

Returns information about a specific cluster including shipping information, cluster status, and other important metadata.

# Arguments

## `ClusterId = ::String` -- *Required*
The automatically generated ID for a cluster.

# Returns

`DescribeClusterResult`

# Exceptions

`InvalidResourceException`.

# Example: To describe a cluster

Returns information about a specific cluster including shipping information, cluster status, and other important metadata.

Input:
```
[
    "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000"
]
```

Output:
```
Dict(
    "ClusterMetadata" => Dict(
        "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
        "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000",
        "ClusterState" => "Pending",
        "CreationDate" => "1480475517.0",
        "Description" => "MyCluster",
        "JobType" => "LOCAL_USE",
        "KmsKeyARN" => "arn:aws:kms:us-east-1:123456789012:key/abcd1234-12ab-34cd-56ef-123456123456",
        "Notification" => Dict(
            "JobStatesToNotify" => [

            ],
            "NotifyAll" => false
        ),
        "Resources" => Dict(
            "S3Resources" => [
                Dict(
                    "BucketArn" => "arn:aws:s3:::MyBucket",
                    "KeyRange" => Dict(

                    )
                )
            ]
        ),
        "RoleARN" => "arn:aws:iam::123456789012:role/snowball-import-S3-role",
        "ShippingOption" => "SECOND_DAY"
    )
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/DescribeCluster)
"""
@inline describe_cluster(aws::AWSConfig=default_aws_config(); args...) = describe_cluster(aws, args)

@inline describe_cluster(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "DescribeCluster", args)

@inline describe_cluster(args) = describe_cluster(default_aws_config(), args)

"""
    using AWSSDK.Snowball.describe_job
    describe_job([::AWSConfig], arguments::Dict)
    describe_job([::AWSConfig]; JobId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "DescribeJob", arguments::Dict)
    snowball([::AWSConfig], "DescribeJob", JobId=)

# DescribeJob Operation

Returns information about a specific job including shipping information, job status, and other important metadata.

# Arguments

## `JobId = ::String` -- *Required*
The automatically generated ID for a job, for example `JID123e4567-e89b-12d3-a456-426655440000`.

# Returns

`DescribeJobResult`

# Exceptions

`InvalidResourceException`.

# Example: To describe a job you've created for AWS Snowball

This operation describes a job you've created for AWS Snowball.

Input:
```
[
    "JobId" => "JID123e4567-e89b-12d3-a456-426655440000"
]
```

Output:
```
Dict(
    "JobMetadata" => Dict(
        "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
        "CreationDate" => "1475626164",
        "Description" => "My Job",
        "JobId" => "JID123e4567-e89b-12d3-a456-426655440000",
        "JobState" => "New",
        "JobType" => "IMPORT",
        "KmsKeyARN" => "arn:aws:kms:us-east-1:123456789012:key/abcd1234-12ab-34cd-56ef-123456123456",
        "Notification" => Dict(
            "JobStatesToNotify" => [

            ],
            "NotifyAll" => false
        ),
        "Resources" => Dict(
            "S3Resources" => [
                Dict(
                    "BucketArn" => "arn:aws:s3:::MyBucket",
                    "KeyRange" => Dict(

                    )
                )
            ]
        ),
        "RoleARN" => "arn:aws:iam::123456789012:role/snowball-import-S3-role",
        "ShippingDetails" => Dict(
            "ShippingOption" => "SECOND_DAY"
        ),
        "SnowballCapacityPreference" => "T80",
        "SnowballType" => "STANDARD"
    )
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/DescribeJob)
"""
@inline describe_job(aws::AWSConfig=default_aws_config(); args...) = describe_job(aws, args)

@inline describe_job(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "DescribeJob", args)

@inline describe_job(args) = describe_job(default_aws_config(), args)

"""
    using AWSSDK.Snowball.get_job_manifest
    get_job_manifest([::AWSConfig], arguments::Dict)
    get_job_manifest([::AWSConfig]; JobId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "GetJobManifest", arguments::Dict)
    snowball([::AWSConfig], "GetJobManifest", JobId=)

# GetJobManifest Operation

Returns a link to an Amazon S3 presigned URL for the manifest file associated with the specified `JobId` value. You can access the manifest file for up to 60 minutes after this request has been made. To access the manifest file after 60 minutes have passed, you'll have to make another call to the `GetJobManifest` action.

The manifest is an encrypted file that you can download after your job enters the `WithCustomer` status. The manifest is decrypted by using the `UnlockCode` code value, when you pass both values to the Snowball through the Snowball client when the client is started for the first time.

As a best practice, we recommend that you don't save a copy of an `UnlockCode` value in the same location as the manifest file for that job. Saving these separately helps prevent unauthorized parties from gaining access to the Snowball associated with that job.

The credentials of a given job, including its manifest file and unlock code, expire 90 days after the job is created.

# Arguments

## `JobId = ::String` -- *Required*
The ID for a job that you want to get the manifest file for, for example `JID123e4567-e89b-12d3-a456-426655440000`.

# Returns

`GetJobManifestResult`

# Exceptions

`InvalidResourceException` or `InvalidJobStateException`.

# Example: To get the manifest for a job you've created for AWS Snowball

Returns a link to an Amazon S3 presigned URL for the manifest file associated with the specified JobId value. You can access the manifest file for up to 60 minutes after this request has been made. To access the manifest file after 60 minutes have passed, you'll have to make another call to the GetJobManifest action.

The manifest is an encrypted file that you can download after your job enters the WithCustomer status. The manifest is decrypted by using the UnlockCode code value, when you pass both values to the Snowball through the Snowball client when the client is started for the first time.

As a best practice, we recommend that you don't save a copy of an UnlockCode value in the same location as the manifest file for that job. Saving these separately helps prevent unauthorized parties from gaining access to the Snowball associated with that job.

The credentials of a given job, including its manifest file and unlock code, expire 90 days after the job is created.

Input:
```
[
    "JobId" => "JID123e4567-e89b-12d3-a456-426655440000"
]
```

Output:
```
Dict(
    "ManifestURI" => "https://awsie-frosty-manifests-prod.s3.amazonaws.com/JID123e4567-e89b-12d3-a456-426655440000_manifest.bin?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20161224T005115Z&X-Amz-SignedHeaders=..."
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/GetJobManifest)
"""
@inline get_job_manifest(aws::AWSConfig=default_aws_config(); args...) = get_job_manifest(aws, args)

@inline get_job_manifest(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "GetJobManifest", args)

@inline get_job_manifest(args) = get_job_manifest(default_aws_config(), args)

"""
    using AWSSDK.Snowball.get_job_unlock_code
    get_job_unlock_code([::AWSConfig], arguments::Dict)
    get_job_unlock_code([::AWSConfig]; JobId=)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "GetJobUnlockCode", arguments::Dict)
    snowball([::AWSConfig], "GetJobUnlockCode", JobId=)

# GetJobUnlockCode Operation

Returns the `UnlockCode` code value for the specified job. A particular `UnlockCode` value can be accessed for up to 90 days after the associated job has been created.

The `UnlockCode` value is a 29-character code with 25 alphanumeric characters and 4 hyphens. This code is used to decrypt the manifest file when it is passed along with the manifest to the Snowball through the Snowball client when the client is started for the first time.

As a best practice, we recommend that you don't save a copy of the `UnlockCode` in the same location as the manifest file for that job. Saving these separately helps prevent unauthorized parties from gaining access to the Snowball associated with that job.

# Arguments

## `JobId = ::String` -- *Required*
The ID for the job that you want to get the `UnlockCode` value for, for example `JID123e4567-e89b-12d3-a456-426655440000`.

# Returns

`GetJobUnlockCodeResult`

# Exceptions

`InvalidResourceException` or `InvalidJobStateException`.

# Example: To get the unlock code for a job you've created for AWS Snowball

Returns the UnlockCode code value for the specified job. A particular UnlockCode value can be accessed for up to 90 days after the associated job has been created.

The UnlockCode value is a 29-character code with 25 alphanumeric characters and 4 hyphens. This code is used to decrypt the manifest file when it is passed along with the manifest to the Snowball through the Snowball client when the client is started for the first time.

As a best practice, we recommend that you don't save a copy of the UnlockCode in the same location as the manifest file for that job. Saving these separately helps prevent unauthorized parties from gaining access to the Snowball associated with that job.

Input:
```
[
    "JobId" => "JID123e4567-e89b-12d3-a456-426655440000"
]
```

Output:
```
Dict(
    "UnlockCode" => "12345-abcde-56789-fghij-01234"
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/GetJobUnlockCode)
"""
@inline get_job_unlock_code(aws::AWSConfig=default_aws_config(); args...) = get_job_unlock_code(aws, args)

@inline get_job_unlock_code(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "GetJobUnlockCode", args)

@inline get_job_unlock_code(args) = get_job_unlock_code(default_aws_config(), args)

"""
    using AWSSDK.Snowball.get_snowball_usage
    get_snowball_usage([::AWSConfig], arguments::Dict)
    get_snowball_usage([::AWSConfig]; )

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "GetSnowballUsage", arguments::Dict)
    snowball([::AWSConfig], "GetSnowballUsage", )

# GetSnowballUsage Operation

Returns information about the Snowball service limit for your account, and also the number of Snowballs your account has in use.

The default service limit for the number of Snowballs that you can have at one time is 1. If you want to increase your service limit, contact AWS Support.

# Arguments

# Returns

`GetSnowballUsageResult`

# Example: To see your Snowball service limit and the number of Snowballs you have in use

Returns information about the Snowball service limit for your account, and also the number of Snowballs your account has in use.

The default service limit for the number of Snowballs that you can have at one time is 1. If you want to increase your service limit, contact AWS Support.

Input:
```
[

]
```

Output:
```
Dict(
    "SnowballLimit" => 1,
    "SnowballsInUse" => 0
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/GetSnowballUsage)
"""
@inline get_snowball_usage(aws::AWSConfig=default_aws_config(); args...) = get_snowball_usage(aws, args)

@inline get_snowball_usage(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "GetSnowballUsage", args)

@inline get_snowball_usage(args) = get_snowball_usage(default_aws_config(), args)

"""
    using AWSSDK.Snowball.list_cluster_jobs
    list_cluster_jobs([::AWSConfig], arguments::Dict)
    list_cluster_jobs([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "ListClusterJobs", arguments::Dict)
    snowball([::AWSConfig], "ListClusterJobs", ClusterId=, <keyword arguments>)

# ListClusterJobs Operation

Returns an array of `JobListEntry` objects of the specified length. Each `JobListEntry` object is for a job in the specified cluster and contains a job's state, a job's ID, and other information.

# Arguments

## `ClusterId = ::String` -- *Required*
The 39-character ID for the cluster that you want to list, for example `CID123e4567-e89b-12d3-a456-426655440000`.

## `MaxResults = ::Int`
The number of `JobListEntry` objects to return.

## `NextToken = ::String`
HTTP requests are stateless. To identify what object comes "next" in the list of `JobListEntry` objects, you have the option of specifying `NextToken` as the starting point for your returned list.

# Returns

`ListClusterJobsResult`

# Exceptions

`InvalidResourceException` or `InvalidNextTokenException`.

# Example: To get a list of jobs in a cluster that you've created for AWS Snowball

Returns an array of JobListEntry objects of the specified length. Each JobListEntry object is for a job in the specified cluster and contains a job's state, a job's ID, and other information.

Input:
```
[
    "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000"
]
```

Output:
```
Dict(
    "JobListEntries" => [
        Dict(
            "CreationDate" => "1480475524.0",
            "Description" => "MyClustrer-node-001",
            "IsMaster" => false,
            "JobId" => "JID123e4567-e89b-12d3-a456-426655440000",
            "JobState" => "New",
            "JobType" => "LOCAL_USE",
            "SnowballType" => "EDGE"
        ),
        Dict(
            "CreationDate" => "1480475525.0",
            "Description" => "MyClustrer-node-002",
            "IsMaster" => false,
            "JobId" => "JID123e4567-e89b-12d3-a456-426655440001",
            "JobState" => "New",
            "JobType" => "LOCAL_USE",
            "SnowballType" => "EDGE"
        ),
        Dict(
            "CreationDate" => "1480475525.0",
            "Description" => "MyClustrer-node-003",
            "IsMaster" => false,
            "JobId" => "JID123e4567-e89b-12d3-a456-426655440002",
            "JobState" => "New",
            "JobType" => "LOCAL_USE",
            "SnowballType" => "EDGE"
        ),
        Dict(
            "CreationDate" => "1480475525.0",
            "Description" => "MyClustrer-node-004",
            "IsMaster" => false,
            "JobId" => "JID123e4567-e89b-12d3-a456-426655440003",
            "JobState" => "New",
            "JobType" => "LOCAL_USE",
            "SnowballType" => "EDGE"
        ),
        Dict(
            "CreationDate" => "1480475525.0",
            "Description" => "MyClustrer-node-005",
            "IsMaster" => false,
            "JobId" => "JID123e4567-e89b-12d3-a456-426655440004",
            "JobState" => "New",
            "JobType" => "LOCAL_USE",
            "SnowballType" => "EDGE"
        )
    ]
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/ListClusterJobs)
"""
@inline list_cluster_jobs(aws::AWSConfig=default_aws_config(); args...) = list_cluster_jobs(aws, args)

@inline list_cluster_jobs(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "ListClusterJobs", args)

@inline list_cluster_jobs(args) = list_cluster_jobs(default_aws_config(), args)

"""
    using AWSSDK.Snowball.list_clusters
    list_clusters([::AWSConfig], arguments::Dict)
    list_clusters([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "ListClusters", arguments::Dict)
    snowball([::AWSConfig], "ListClusters", <keyword arguments>)

# ListClusters Operation

Returns an array of `ClusterListEntry` objects of the specified length. Each `ClusterListEntry` object contains a cluster's state, a cluster's ID, and other important status information.

# Arguments

## `MaxResults = ::Int`
The number of `ClusterListEntry` objects to return.

## `NextToken = ::String`
HTTP requests are stateless. To identify what object comes "next" in the list of `ClusterListEntry` objects, you have the option of specifying `NextToken` as the starting point for your returned list.

# Returns

`ListClustersResult`

# Exceptions

`InvalidNextTokenException`.

# Example: To get a list of clusters that you've created for AWS Snowball

Returns an array of ClusterListEntry objects of the specified length. Each ClusterListEntry object contains a cluster's state, a cluster's ID, and other important status information.

Input:
```
[

]
```

Output:
```
Dict(
    "ClusterListEntries" => [
        Dict(
            "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000",
            "ClusterState" => "Pending",
            "CreationDate" => "1480475517.0",
            "Description" => "MyCluster"
        )
    ]
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/ListClusters)
"""
@inline list_clusters(aws::AWSConfig=default_aws_config(); args...) = list_clusters(aws, args)

@inline list_clusters(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "ListClusters", args)

@inline list_clusters(args) = list_clusters(default_aws_config(), args)

"""
    using AWSSDK.Snowball.list_compatible_images
    list_compatible_images([::AWSConfig], arguments::Dict)
    list_compatible_images([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "ListCompatibleImages", arguments::Dict)
    snowball([::AWSConfig], "ListCompatibleImages", <keyword arguments>)

# ListCompatibleImages Operation

This action returns a list of the different Amazon EC2 Amazon Machine Images (AMIs) that are owned by your AWS account that would be supported for use on a Snowball Edge device. Currently, supported AMIs are based on the CentOS 7 (x86_64) - with Updates HVM, Ubuntu Server 14.04 LTS (HVM), and Ubuntu 16.04 LTS - Xenial (HVM) images, available on the AWS Marketplace.

# Arguments

## `MaxResults = ::Int`
The maximum number of results for the list of compatible images. Currently, a Snowball Edge device can store 10 AMIs.

## `NextToken = ::String`
HTTP requests are stateless. To identify what object comes "next" in the list of compatible images, you can specify a value for `NextToken` as the starting point for your list of returned images.

# Returns

`ListCompatibleImagesResult`

# Exceptions

`InvalidNextTokenException` or `Ec2RequestFailedException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/ListCompatibleImages)
"""
@inline list_compatible_images(aws::AWSConfig=default_aws_config(); args...) = list_compatible_images(aws, args)

@inline list_compatible_images(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "ListCompatibleImages", args)

@inline list_compatible_images(args) = list_compatible_images(default_aws_config(), args)

"""
    using AWSSDK.Snowball.list_jobs
    list_jobs([::AWSConfig], arguments::Dict)
    list_jobs([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "ListJobs", arguments::Dict)
    snowball([::AWSConfig], "ListJobs", <keyword arguments>)

# ListJobs Operation

Returns an array of `JobListEntry` objects of the specified length. Each `JobListEntry` object contains a job's state, a job's ID, and a value that indicates whether the job is a job part, in the case of export jobs. Calling this API action in one of the US regions will return jobs from the list of all jobs associated with this account in all US regions.

# Arguments

## `MaxResults = ::Int`
The number of `JobListEntry` objects to return.

## `NextToken = ::String`
HTTP requests are stateless. To identify what object comes "next" in the list of `JobListEntry` objects, you have the option of specifying `NextToken` as the starting point for your returned list.

# Returns

`ListJobsResult`

# Exceptions

`InvalidNextTokenException`.

# Example: To get a list of jobs that you've created for AWS Snowball

Returns an array of JobListEntry objects of the specified length. Each JobListEntry object contains a job's state, a job's ID, and a value that indicates whether the job is a job part, in the case of export jobs. Calling this API action in one of the US regions will return jobs from the list of all jobs associated with this account in all US regions.

Input:
```
[

]
```

Output:
```
Dict(
    "JobListEntries" => [
        Dict(
            "CreationDate" => "1460678186.0",
            "Description" => "MyJob",
            "IsMaster" => false,
            "JobId" => "JID123e4567-e89b-12d3-a456-426655440000",
            "JobState" => "New",
            "JobType" => "IMPORT",
            "SnowballType" => "STANDARD"
        )
    ]
)
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/ListJobs)
"""
@inline list_jobs(aws::AWSConfig=default_aws_config(); args...) = list_jobs(aws, args)

@inline list_jobs(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "ListJobs", args)

@inline list_jobs(args) = list_jobs(default_aws_config(), args)

"""
    using AWSSDK.Snowball.update_cluster
    update_cluster([::AWSConfig], arguments::Dict)
    update_cluster([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "UpdateCluster", arguments::Dict)
    snowball([::AWSConfig], "UpdateCluster", ClusterId=, <keyword arguments>)

# UpdateCluster Operation

While a cluster's `ClusterState` value is in the `AwaitingQuorum` state, you can update some of the information associated with a cluster. Once the cluster changes to a different job state, usually 60 minutes after the cluster being created, this action is no longer available.

# Arguments

## `ClusterId = ::String` -- *Required*
The cluster ID of the cluster that you want to update, for example `CID123e4567-e89b-12d3-a456-426655440000`.

## `RoleARN = ::String`
The new role Amazon Resource Name (ARN) that you want to associate with this cluster. To create a role ARN, use the [CreateRole](http://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html) API action in AWS Identity and Access Management (IAM).

## `Description = ::String`
The updated description of this cluster.

## `Resources = [ ... ]`
The updated arrays of [JobResource](@ref) objects that can include updated [S3Resource](@ref) objects or [LambdaResource](@ref) objects.
```
 Resources = [
        "S3Resources" =>  [[
            "BucketArn" =>  ::String,
            "KeyRange" =>  [
                "BeginMarker" =>  ::String,
                "EndMarker" =>  ::String
            ]
        ], ...],
        "LambdaResources" =>  [[
            "LambdaArn" =>  ::String,
            "EventTriggers" =>  [["EventResourceARN" =>  ::String], ...]
        ], ...],
        "Ec2AmiResources" =>  [[
            "AmiId" => <required> ::String,
            "SnowballAmiId" =>  ::String
        ], ...]
    ]
```

## `AddressId = ::String`
The ID of the updated [Address](@ref) object.

## `ShippingOption = "SECOND_DAY", "NEXT_DAY", "EXPRESS" or "STANDARD"`
The updated shipping option value of this cluster's [ShippingDetails](@ref) object.

## `Notification = [ ... ]`
The new or updated [Notification](@ref) object.
```
 Notification = [
        "SnsTopicARN" =>  ::String,
        "JobStatesToNotify" =>  ["New", "PreparingAppliance", "PreparingShipment", "InTransitToCustomer", "WithCustomer", "InTransitToAWS", "WithAWS", "InProgress", "Complete", "Cancelled", "Listing" or "Pending", ...],
        "NotifyAll" =>  ::Bool
    ]
```

## `ForwardingAddressId = ::String`
The updated ID for the forwarding address for a cluster. This field is not supported in most regions.

# Returns

`UpdateClusterResult`

# Exceptions

`InvalidResourceException`, `InvalidJobStateException`, `KMSRequestFailedException`, `InvalidInputCombinationException` or `Ec2RequestFailedException`.

# Example: To update a cluster

This action allows you to update certain parameters for a cluster. Once the cluster changes to a different state, usually within 60 minutes of it being created, this action is no longer available.

Input:
```
[
    "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
    "ClusterId" => "CID123e4567-e89b-12d3-a456-426655440000",
    "Description" => "Updated the address to send this to image processing - RJ"
]
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/UpdateCluster)
"""
@inline update_cluster(aws::AWSConfig=default_aws_config(); args...) = update_cluster(aws, args)

@inline update_cluster(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "UpdateCluster", args)

@inline update_cluster(args) = update_cluster(default_aws_config(), args)

"""
    using AWSSDK.Snowball.update_job
    update_job([::AWSConfig], arguments::Dict)
    update_job([::AWSConfig]; JobId=, <keyword arguments>)

    using AWSCore.Services.snowball
    snowball([::AWSConfig], "UpdateJob", arguments::Dict)
    snowball([::AWSConfig], "UpdateJob", JobId=, <keyword arguments>)

# UpdateJob Operation

While a job's `JobState` value is `New`, you can update some of the information associated with a job. Once the job changes to a different job state, usually within 60 minutes of the job being created, this action is no longer available.

# Arguments

## `JobId = ::String` -- *Required*
The job ID of the job that you want to update, for example `JID123e4567-e89b-12d3-a456-426655440000`.

## `RoleARN = ::String`
The new role Amazon Resource Name (ARN) that you want to associate with this job. To create a role ARN, use the [CreateRole](http://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html)AWS Identity and Access Management (IAM) API action.

## `Notification = [ ... ]`
The new or updated [Notification](@ref) object.
```
 Notification = [
        "SnsTopicARN" =>  ::String,
        "JobStatesToNotify" =>  ["New", "PreparingAppliance", "PreparingShipment", "InTransitToCustomer", "WithCustomer", "InTransitToAWS", "WithAWS", "InProgress", "Complete", "Cancelled", "Listing" or "Pending", ...],
        "NotifyAll" =>  ::Bool
    ]
```

## `Resources = [ ... ]`
The updated `JobResource` object, or the updated [JobResource](@ref) object.
```
 Resources = [
        "S3Resources" =>  [[
            "BucketArn" =>  ::String,
            "KeyRange" =>  [
                "BeginMarker" =>  ::String,
                "EndMarker" =>  ::String
            ]
        ], ...],
        "LambdaResources" =>  [[
            "LambdaArn" =>  ::String,
            "EventTriggers" =>  [["EventResourceARN" =>  ::String], ...]
        ], ...],
        "Ec2AmiResources" =>  [[
            "AmiId" => <required> ::String,
            "SnowballAmiId" =>  ::String
        ], ...]
    ]
```

## `AddressId = ::String`
The ID of the updated [Address](@ref) object.

## `ShippingOption = "SECOND_DAY", "NEXT_DAY", "EXPRESS" or "STANDARD"`
The updated shipping option value of this job's [ShippingDetails](@ref) object.

## `Description = ::String`
The updated description of this job's [JobMetadata](@ref) object.

## `SnowballCapacityPreference = "T50", "T80", "T100" or "NoPreference"`
The updated `SnowballCapacityPreference` of this job's [JobMetadata](@ref) object. The 50 TB Snowballs are only available in the US regions.

## `ForwardingAddressId = ::String`
The updated ID for the forwarding address for a job. This field is not supported in most regions.

# Returns

`UpdateJobResult`

# Exceptions

`InvalidResourceException`, `InvalidJobStateException`, `KMSRequestFailedException`, `InvalidInputCombinationException`, `ClusterLimitExceededException` or `Ec2RequestFailedException`.

# Example: To update a job

This action allows you to update certain parameters for a job. Once the job changes to a different job state, usually within 60 minutes of the job being created, this action is no longer available.

Input:
```
[
    "AddressId" => "ADID1234ab12-3eec-4eb3-9be6-9374c10eb51b",
    "Description" => "Upgraded to Edge, shipped to Finance Dept, and requested faster shipping speed - TS.",
    "JobId" => "JID123e4567-e89b-12d3-a456-426655440000",
    "ShippingOption" => "NEXT_DAY",
    "SnowballCapacityPreference" => "T100"
]
```

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/snowball-2016-06-30/UpdateJob)
"""
@inline update_job(aws::AWSConfig=default_aws_config(); args...) = update_job(aws, args)

@inline update_job(aws::AWSConfig, args) = AWSCore.Services.snowball(aws, "UpdateJob", args)

@inline update_job(args) = update_job(default_aws_config(), args)

end # module Snowball

#==============================================================================#
# End of file
#==============================================================================#


text:
using MelissasModule
using Test

@testset "Test hitting target" begin
    imprecise_trebuchet = Trebuchet(500.0, 0.25pi)
    environment = Environment(5, 100)
    precise_trebuchet = aim(imprecise_trebuchet, environment)
    @test shoot_distance(precise_trebuchet, environment) >= 100
end

ext: jl


text:
test_gage_principal_axes(
    [1. 1. 0.;
     0. 0. 0.;],
    eye(3),
     "new rotation center";
     center=[0.,1.,0.])


text:
module TestGeneralizedTF
using CustomTest
using Base.Test
using ControlSystems

# CONTINUOUS
C_011 = tfg("(s+2)")
C_111 = tfg("(s+1)/(s+2)")
@test C_011*C_111 == tfg("(s+2)*((s+1)/(s+2))")

#We might want to make evalfr scalar
@test C_011(1im) == reshape([2+1im;],1,1)
@test (C_111*C_011)(im) == reshape([1.0+1im],1,1)

@test tf(C_111) == tf([1,1],[1,2])
@test zpk(C_011*C_111) == zpk([-1,-2],[-2],1)

@test bode(C_111*C_011, logspace(-1,1)) == bode(tfg("(s+2)*((s+1)/(s+2))"), logspace(-1,1))
end


text:
"""
OLSFn

Run the (first-stage) time-series regressions for the asset pricing model to obtain the alpha and betas for each test assets

INPUT
`Y': T x N matrix of dependent varaible
`X': T x (K + 1) matrix with K explanatory variables and one intercept term
`cov_method': method for calculating the variance-covariance matrix of the error terms:
            - time iid: error terms are iid across time but cross-sectionally correlated
            - iid: error terms are iiid both across time and assets
            - NW: Newey-West covariance matrix with m lags
            - HH: Hansen-Hodrick covariane matrix with m lags
`m': number of lags for the Newey-West or Hansen-Hodrick covariance matrix

OUTPUT
`alpha': N x 1 vector of alphas of the test assets
`beta': N x K matrix of the betas of the test assets. There are N test assets and K factors
`resid': T x N matrix of the pricing errors
`cov_resid': N x N matrix of covariance matrix of the pricing errors
"""

function OLSFn(Y, X, cov_method = "time iid", m = 0)
    beta = (X' * X) \ (X' * Y); # (K+1) x N
    resid = Y - X * beta;
    alpha = beta[1, :]; # alphas N x 1
    beta = beta[2:end, :]'; # betas N x K

    # Method of estimating the covariance matrix of residuals for OLS
    if cov_method == "time iid" # iid across time but cross-sectionally correlated
        cov_resid = cov(resid);
    elseif cov_method == "iid" # iid
        cov_resid = cov(resid);
        cov_resid = diagm(diag(cov_resid));
    elseif cov_method == "NW" # Newey-West
        cov_resid = cov(resid);
        for i = 1:m
            w = 1 - i / (m + 1);
            cov_resid = cov_resid + 2 * w * (1 / (T - 1 - i)) * resid[1:end - i, :]' * resid[1 + i:end, :];
        end
    elseif cov_method == "HH" # Hansen-Hodrick
        cov_resid = cov(resid)
        for i = 1:m
            cov_resid = cov_resid + (2 / (T - 1 - i)) * resid[1:end - i, :]' * resid[1 + i:end, :];
        end
    end

    return (alpha, beta, resid, cov_resid)
end


text:
module ecgconfig

global FS = 500
global DETECTOR_AMF_THRESHOLD = 0.2

DETECTOR_RPEAK_SPACING_MSEC = 130.0

DETECTOR_T_FROM_R_MSEC = 70.0
DETECTOR_T_INTERVAL_RATIO = 0.7

DETECTOR_AMF_SMOOTH_MSEC = 500.0
DETECTOR_AMF_WIDTH_THRESHOLD_MSEC = 60.0

HR_TACHY = 150.0
HR_BRADY = 40.0
HR_PAUSE = 2.0

ECTOPIC_RATIO = 0.7
ECTOPIC_WIDTH_MSEC = 100.0

end


text:
"""
    SeisUnPatch(in,out;<keyword arguments>)

Reconstruct a 5D data volume from a set of 5D data patches.

# Arguments
* `in::Array{AbstractString,1}`: array containing filename of patches
* `out::AbstractString`: filename for reconstructed volume

# Keyword arguments
* `style="sxsygxgy"`: bin style. Options: "mxmyhxhy","mxmyhaz","sxsyhxhy","gxgyhxhy","sxsyhaz","gxgyhaz"
* `min_isx=0`,`max_isx=0`,`min_isy=0`,`max_isy=0`: grid extreme values for sources
* `min_igx=0`,`max_igx=0`,`min_igy=0`,`max_igy=0`: grid extreme values for receivers
* `min_imx=0`,`max_imx=0`,`min_imy=0`,`max_imy=0`: grid extreme values for midpoints
* `min_ihx=0`,`max_ihx=0`,`min_ihy=0`,`max_ihy=0`: grid extreme values for offsets
* `min_ih=0`,`max_ih=0`,`min_iaz=0`,`max_iaz=0`: grid extreme values for azimuth and offset
* `it_WL=9e9`,`it_WO=0` : length and overlapping samples in time patches
* `ix1_WL=9e9`,`ix1_WO=0`:length and overlapping samples in first space dimension
* `ix2_WL=9e9`,`ix2_WO=0`,`ix3_WL=9e9`,`ix3_WO=0`,`ix4_WL=9e9`,`ix4_WO=0`
* `nt=0`: time samples of reconstructed cube
* `ang=90`: inline direction measured in degrees CC from East
* `gamma=1`: vp/vs ratio for PS Asymptotic Conversion Point gathers (use gamma=1 for PP data)
* `osx=0`,`osy=0`,`ogx=0`,`ogy=0` : origin for source and receiver coordinate system
* `omx=0`,`omy=0`,`ohx=0`,`ohy=0`: origin for midpoint and offset coordinate system
* `oaz=0`,`oh=0` : origin for azimuth and offset coordinate system
* `dsx=1`,`dsy=1`,`dgx=1`,`dgy=1`: source and receiver step-size
* `dmx=1`,`dmy=1`,`dhx=1`,`dhy=1`: midpoint and offset step-size
* `dh=1`,`daz=1`: offset and azimuth step-size

# Output
In file `out`, the 5D reconstructed volume is created.

*Credits: A. Stanton, F Carozzi, 2017*
"""

function SeisUnPatch(patch_names::Array{AbstractString,1},out::AbstractString;style="sxsygxgy",min_isx=0,max_isx=0,min_isy=0,max_isy=0,min_igx=0,max_igx=0,min_igy=0,max_igy=0,min_imx=0,max_imx=0,min_imy=0,max_imy=0,min_ihx=0,max_ihx=0,min_ihy=0,max_ihy=0,min_ih=0,max_ih=0,min_iaz=0,max_iaz=0,it_WL=9e9,it_WO=0,ix1_WL=9e9,ix1_WO=0,ix2_WL=9e9,ix2_WO=0,ix3_WL=9e9,ix3_WO=0,ix4_WL=9e9,ix4_WO=0,nt=0,ang=90,gamma=1,osx=0,osy=0,ogx=0,ogy=0,omx=0,omy=0,ohx=0,ohy=0,oh=0,oaz=0,dsx=1,dsy=1,dgx=1,dgy=1,dmx=1,dmy=1,dhx=1,dhy=1,dh=1,daz=1)

    if (style == "sxsygxgy")
	key = ["t","isx","isy","igx","igy"]
	min_ix1 = min_isx
	max_ix1 = max_isx
	min_ix2 = min_isy
	max_ix2 = max_isy
	min_ix3 = min_igx
	max_ix3 = max_igx
	min_ix4 = min_igy
	max_ix4 = max_igy
    elseif (style=="mxmyhxhy")
	key = ["t","imx","imy","ihx","ihy"]
	min_ix1 = min_imx
	max_ix1 = max_imx
	min_ix2 = min_imy
	max_ix2 = max_imy
	min_ix3 = min_ihx
	max_ix3 = max_ihx
	min_ix4 = min_ihy
	max_ix4 = max_ihy
    elseif (style=="mxmyhaz")
	key = ["t","imx","imy","ih","iaz"]
	min_ix1 = min_imx
	max_ix1 = max_imx
	min_ix2 = min_imy
	max_ix2 = max_imy
	min_ix3 = min_ih
	max_ix3 = max_ih
	min_ix4 = min_iaz
	max_ix4 = max_iaz
    elseif (style=="sxsyhxhy")
	key = ["t","isx","isy","ihx","ihy"]
	min_ix1 = min_isx
	max_ix1 = max_isx
	min_ix2 = min_isy
	max_ix2 = max_isy
	min_ix3 = min_ihx
	max_ix3 = max_ihx
	min_ix4 = min_ihy
	max_ix4 = max_ihy
    elseif (style=="gxgyhxhy")
	key = ["t","igx","igy","ihx","ihy"]
	min_ix1 = min_igx
	max_ix1 = max_igx
	min_ix2 = min_igy
	max_ix2 = max_igy
	min_ix3 = min_ihx
	max_ix3 = max_ihx
	min_ix4 = min_ihy
	max_ix4 = max_ihy
    elseif (style=="sxsyhaz")
	key = ["t","isx","isy","ih","iaz"]
	min_ix1 = min_isx
	max_ix1 = max_isx
	min_ix2 = min_isy
	max_ix2 = max_isy
	min_ix3 = min_ih
	max_ix3 = max_ih
	min_ix4 = min_iaz
	max_ix4 = max_iaz
    elseif (style=="gxgyhaz")
	key = ["t","igx","igy","ih","iaz"]
	min_ix1 = min_igx
	max_ix1 = max_igx
	min_ix2 = min_igy
		max_ix2 = max_igy
	min_ix3 = min_ih
	max_ix3 = max_ih
	min_ix4 = min_iaz
	max_ix4 = max_iaz
    else
	error("style not defined.")
    end
    nx1 = max_ix1 - min_ix1 + 1
    nx2 = max_ix2 - min_ix2 + 1
    nx3 = max_ix3 - min_ix3 + 1
    nx4 = max_ix4 - min_ix4 + 1

    it_WL  = it_WL  > nt  ? nt  : it_WL
    ix1_WL = ix1_WL > nx1 ? nx1 : ix1_WL
	ix2_WL = ix2_WL > nx2 ? nx2 : ix2_WL
    ix3_WL = ix3_WL > nx3 ? nx3 : ix3_WL
    ix4_WL = ix4_WL > nx4 ? nx4 : ix4_WL

    rad2deg = 180/pi
    deg2rad = pi/180
    gammainv = 1/gamma
    if (ang > 90)
	ang2=-deg2rad*(ang-90)
    else
	ang2=deg2rad*(90-ang)
    end

    nsx = max_isx - min_isx + 1
    nsy = max_isy - min_isy + 1
    ngx = max_igx - min_igx + 1
    ngy = max_igy - min_igy + 1

    nmx = max_imx - min_imx + 1
    nmy = max_imy - min_imy + 1
    nhx = max_ihx - min_ihx + 1
    nhy = max_ihy - min_ihy + 1
    nh = max_ih - min_ih + 1
    naz = max_iaz - min_iaz + 1

    if (style=="sxsygxgy")
	nx1=nsx; nx2=nsy; nx3=ngx; nx4=ngy
    elseif (style=="mxmyhxhy")
	nx1=nmx; nx2=nmy; nx3=nhx; nx4=nhy
    elseif (style=="mxmyhaz")
	nx1=nmx; nx2=nmy; nx3=nh; nx4=naz
    elseif (style=="sxsyhxhy")
	nx1=nsx; nx2=nsy; nx3=nhx; nx4=nhy
    elseif (style=="gxgyhxhy")
	nx1=ngx; nx2=ngy; nx3=nhx; nx4=nhy
    elseif (style=="sxsyhaz")
	nx1=nsx; nx2=nsy; nx3=nh; nx4=naz
    elseif (style=="gxgyhaz")
	nx1=ngx; nx2=ngy; nx3=nh; nx4=naz
	else
	    error("style not recognized.")
	end

    filename_data = ParseDataName(patch_names[1])
    filename_headers = ParseHeaderName(patch_names[1])
    extent = ReadTextHeader(patch_names[1])

    dt = extent.d1
    ot = extent.o1
    d = zeros(Float32,nt,1)
    h = Array(Header,1)
    h[1] = InitSeisHeader()

    extent = Seismic.Extent(nt, max_ix1-min_ix1+1, max_ix2-min_ix2+1,
                            max_ix3-min_ix3+1, max_ix4-min_ix4+1,convert(Float32,ot), 0, 0, 0,
                            0, convert(Float32,dt), 1, 1, 1, 1, "", "", "", "", "", "", "", "",
                            "", "", "")
println("creating headers")
   j = 1
    for ix4 = 1 : nx4
	     for ix3 = 1 : nx3
	        for ix2 = 1 : nx2
		          for ix1 = 1 : nx1
		              h[1].tracenum = convert(typeof(h[1].tracenum),j)

        h[1].o1 = convert(typeof(h[1].o1),ot)
		    h[1].n1 = convert(typeof(h[1].n1),nt)
		    h[1].d1 = convert(typeof(h[1].d1),dt)

		    if (style=="sxsygxgy")
			h[1].isx = convert(typeof(h[1].isx),ix1 - 1 + min_isx)
			h[1].isy = convert(typeof(h[1].isy),ix2 - 1 + min_isy)
			h[1].igx = convert(typeof(h[1].igx),ix3 - 1 + min_igx)
			h[1].igy = convert(typeof(h[1].igy),ix4 - 1 + min_igy)
			sx_rot = convert(Float32,(ix1 - 1 + min_isx)*dsx + osx)
			sy_rot = convert(Float32,(ix2 - 1 + min_isy)*dsy + osy)
			gx_rot = convert(Float32,(ix3 - 1 + min_igx)*dgx + ogx)
			gy_rot = convert(Float32,(ix4 - 1 + min_igy)*dgy + ogy)
			h[1].sx =  (sx_rot-osx)*cos(ang2) + (sy_rot-osy)*sin(ang2) + osx
			h[1].sy = -(sx_rot-osx)*sin(ang2) + (sy_rot-osy)*cos(ang2) + osy
			h[1].gx =  (gx_rot-ogx)*cos(ang2) + (gy_rot-ogy)*sin(ang2) + ogx
			h[1].gy = -(gx_rot-ogx)*sin(ang2) + (gy_rot-ogy)*cos(ang2) + ogy
			h[1].hx = h[1].gx - h[1].sx
			h[1].hy = h[1].gy - h[1].sy
			h[1].h = sqrt((h[1].hx^2) + (h[1].hy^2))
			h[1].az = rad2deg*atan2((h[1].gy-h[1].sy),(h[1].gx-h[1].sx))
			if (h[1].az < 0)
			    h[1].az += 360.0
			end
			h[1].mx = h[1].sx + h[1].hx/(1 + gammainv)
			h[1].my = h[1].sy + h[1].hy/(1 + gammainv)
			mx_rot = (h[1].mx-omx)*cos(ang2) - (h[1].my-omy)*sin(ang2) + omx
			my_rot = (h[1].mx-omx)*sin(ang2) + (h[1].my-omy)*cos(ang2) + omy
			hx_rot = (h[1].hx-ohx)*cos(ang2) - (h[1].hy-ohy)*sin(ang2) + ohx
			hy_rot = (h[1].hx-ohx)*sin(ang2) + (h[1].hy-ohy)*cos(ang2) + ohy
			h[1].imx = convert(Int32,round((mx_rot-omx)/dmx))
			h[1].imy = convert(Int32,round((my_rot-omy)/dmy))
			h[1].ihx = convert(Int32,round((hx_rot-ohx)/dhx))
			h[1].ihy = convert(Int32,round((hy_rot-ohy)/dhy))
			h[1].ih = convert(Int32,round((h[1].h-oh)/dh))
			h[1].iaz = convert(Int32,round((h[1].az-oaz)/daz))
		    elseif (style=="mxmyhxhy")
			h[1].imx = convert(typeof(h[1].imx),ix1 - 1 + min_imx)
 			h[1].imy = convert(typeof(h[1].imy),ix2 - 1 + min_imy)
 			h[1].ihx = convert(typeof(h[1].ihx),ix3 - 1 + min_ihx)
			h[1].ihy = convert(typeof(h[1].ihy),ix4 - 1 + min_ihy)
			mx_rot = convert(Float32,(ix1 - 1 + min_imx)*dmx + omx)
			my_rot = convert(Float32,(ix2 - 1 + min_imy)*dmy + omy)
			hx_rot = convert(Float32,(ix3 - 1 + min_ihx)*dhx + ohx)
			hy_rot = convert(Float32,(ix4 - 1 + min_ihy)*dhy + ohy)
			h[1].mx =  (mx_rot-omx)*cos(ang2) + (my_rot-omy)*sin(ang2) + omx
			h[1].my = -(mx_rot-omx)*sin(ang2) + (my_rot-omy)*cos(ang2) + omy
			h[1].hx =  (hx_rot-ohx)*cos(ang2) + (hy_rot-ohy)*sin(ang2) + ohx
			h[1].hy = -(hx_rot-ohx)*sin(ang2) + (hy_rot-ohy)*cos(ang2) + ohy
			h[1].sx = h[1].mx - h[1].hx/(1 + gammainv)
			h[1].sy = h[1].my - h[1].hy/(1 + gammainv)
			h[1].gx = h[1].mx + h[1].hx*(1-(1/(1 + gammainv)))
			h[1].gy = h[1].my + h[1].hy*(1-(1/(1 + gammainv)))
			sx_rot = (h[1].sx-osx)*cos(ang2) - (h[1].sy-osy)*sin(ang2) + osx
			sy_rot = (h[1].sx-osx)*sin(ang2) + (h[1].sy-osy)*cos(ang2) + osy
			gx_rot = (h[1].gx-ogx)*cos(ang2) - (h[1].gy-ogy)*sin(ang2) + ogx
			gy_rot = (h[1].gx-ogx)*sin(ang2) + (h[1].gy-ogy)*cos(ang2) + ogy
			h[1].isx = convert(Int32,round((sx_rot-osx)/dsx))
			h[1].isy = convert(Int32,round((sy_rot-osy)/dsy))
			h[1].igx = convert(Int32,round((gx_rot-ogx)/dgx))
			h[1].igy = convert(Int32,round((gy_rot-ogy)/dgy))
			h[1].h = sqrt((h[1].hx^2) + (h[1].hy^2))
			h[1].az = rad2deg*atan2((h[1].gy-h[1].sy),(h[1].gx-h[1].sx))
			if (h[1].az < 0)
			    h[1].az += 360.0
			end
			h[1].ih = convert(Int32,round((h[1].h-oh)/dh))
			h[1].iaz = convert(Int32,round((h[1].az-oaz)/daz))
		    elseif (style=="mxmyhaz")
			h[1].imx = convert(typeof(h[1].imx),ix1 - 1 + min_imx)
			h[1].imy = convert(typeof(h[1].imy),ix2 - 1 + min_imy)
			h[1].ih = convert(typeof(h[1].ih),  ix3 - 1 + min_ih)
			h[1].iaz = convert(typeof(h[1].iaz),ix4 - 1 + min_iaz)
			mx_rot = convert(Float32,(ix1 - 1 + min_imx)*dmx + omx)
			my_rot = convert(Float32,(ix2 - 1 + min_imy)*dmy + omy)
			h[1].mx =  (mx_rot-omx)*cos(ang2) + (my_rot-omy)*sin(ang2) + omx
			h[1].my = -(mx_rot-omx)*sin(ang2) + (my_rot-omy)*cos(ang2) + omy
			h[1].h = convert(Float32,(ix3 - 1 + min_ih)*dh + oh)
			h[1].az = convert(Float32,(ix4 - 1 + min_iaz)*daz + oaz)
			if (h[1].az <= 90)
			    h[1].hx = h[1].h*cos(deg2rad*h[1].az)
			    h[1].hy = h[1].h*sin(deg2rad*h[1].az)
			elseif (h[1].az > 90 && h[1].az <= 180)
			    h[1].hx =-h[1].h*cos(pi-(deg2rad*h[1].az))
			    h[1].hy = h[1].h*sin(pi-(deg2rad*h[1].az))
			elseif (h[1].az > 180 && h[1].az <= 270)
			    h[1].hx =-h[1].h*cos((deg2rad*h[1].az)-pi)
			    h[1].hy =-h[1].h*sin((deg2rad*h[1].az)-pi)
			else
			    h[1].hx = h[1].h*cos(2*pi-(deg2rad*h[1].az))
			    h[1].hy =-h[1].h*sin(2*pi-(deg2rad*h[1].az))
			end
			h[1].sx = h[1].mx - h[1].hx/(1 + gammainv)
			h[1].sy = h[1].my - h[1].hy/(1 + gammainv)
			h[1].gx = h[1].mx + h[1].hx*(1-(1/(1 + gammainv)))
			h[1].gy = h[1].my + h[1].hy*(1-(1/(1 + gammainv)))
			sx_rot = (h[1].sx-osx)*cos(ang2) - (h[1].sy-osy)*sin(ang2) + osx
			sy_rot = (h[1].sx-osx)*sin(ang2) + (h[1].sy-osy)*cos(ang2) + osy
			gx_rot = (h[1].gx-ogx)*cos(ang2) - (h[1].gy-ogy)*sin(ang2) + ogx
			gy_rot = (h[1].gx-ogx)*sin(ang2) + (h[1].gy-ogy)*cos(ang2) + ogy
			h[1].isx = convert(Int32,round((sx_rot-osx)/dsx))
			h[1].isy = convert(Int32,round((sy_rot-osy)/dsy))
			h[1].igx = convert(Int32,round((gx_rot-ogx)/dgx))
			h[1].igy = convert(Int32,round((gy_rot-ogy)/dgy))
			hx_rot = (h[1].hx-ohx)*cos(ang2) - (h[1].hy-ohy)*sin(ang2) + ohx
			hy_rot = (h[1].hx-ohx)*sin(ang2) + (h[1].hy-ohy)*cos(ang2) + ohy
			h[1].ihx = convert(Int32,round((hx_rot-ohx)/dhx))
			h[1].ihy = convert(Int32,round((hy_rot-ohy)/dhy))
		    elseif (style=="sxsyhxhy")
			h[1].isx = convert(typeof(h[1].isx),ix1 - 1 + min_isx)
			h[1].isy = convert(typeof(h[1].isy),ix2 - 1 + min_isy)
			h[1].ihx = convert(typeof(h[1].ihx),ix3 - 1 + min_ihx)
			h[1].ihy = convert(typeof(h[1].ihy),ix4 - 1 + min_ihy)
			sx_rot = convert(Float32,(ix1 - 1 + min_isx)*dsx + osx)
			sy_rot = convert(Float32,(ix2 - 1 + min_isy)*dsy + osy)
			hx_rot = convert(Float32,(ix3 - 1 + min_ihx)*dhx + ohx)
			hy_rot = convert(Float32,(ix4 - 1 + min_ihy)*dhy + ohy)
			h[1].sx =  (sx_rot-osx)*cos(ang2) + (sy_rot-osy)*sin(ang2) + osx
			h[1].sy = -(sx_rot-osx)*sin(ang2) + (sy_rot-osy)*cos(ang2) + osy
			h[1].hx =  (hx_rot-ohx)*cos(ang2) + (hy_rot-ohy)*sin(ang2) + ohx
			h[1].hy = -(hx_rot-ohx)*sin(ang2) + (hy_rot-ohy)*cos(ang2) + ohy
			h[1].gx = h[1].sx + h[1].hx
			h[1].gy = h[1].sy + h[1].hy
			h[1].h = sqrt((h[1].hx^2) + (h[1].hy^2))
			h[1].az = rad2deg*atan2((h[1].gy-h[1].sy),(h[1].gx-h[1].sx))
			if (h[1].az < 0)
			    h[1].az += 360.0
			end
			h[1].mx = h[1].sx + h[1].hx/(1 + gammainv)
			h[1].my = h[1].sy + h[1].hy/(1 + gammainv)
			mx_rot = (h[1].mx-omx)*cos(ang2) - (h[1].my-omy)*sin(ang2) + omx
			my_rot = (h[1].mx-omx)*sin(ang2) + (h[1].my-omy)*cos(ang2) + omy
			hx_rot = (h[1].hx-ohx)*cos(ang2) - (h[1].hy-ohy)*sin(ang2) + ohx
			hy_rot = (h[1].hx-ohx)*sin(ang2) + (h[1].hy-ohy)*cos(ang2) + ohy
			h[1].imx = convert(Int32,round((mx_rot-omx)/dmx))
			h[1].imy = convert(Int32,round((my_rot-omy)/dmy))
			h[1].ihx = convert(Int32,round((hx_rot-ohx)/dhx))
			h[1].ihy = convert(Int32,round((hy_rot-ohy)/dhy))
			h[1].ih = convert(Int32,round((h[1].h-oh)/dh))
			h[1].iaz = convert(Int32,round((h[1].az-oaz)/daz))
		    elseif (style=="gxgyhxhy")
			h[1].igx = convert(typeof(h[1].igx),ix1 - 1 + min_igx)
			h[1].igy = convert(typeof(h[1].igy),ix2 - 1 + min_igy)
			h[1].ihx = convert(typeof(h[1].ihx),ix3 - 1 + min_ihx)
			h[1].ihy = convert(typeof(h[1].ihy),ix4 - 1 + min_ihy)
			gx_rot = convert(Float32,(ix1 - 1 + min_igx)*dgx + ogx)
			gy_rot = convert(Float32,(ix2 - 1 + min_igy)*dgy + ogy)
			hx_rot = convert(Float32,(ix3 - 1 + min_ihx)*dhx + ohx)
			hy_rot = convert(Float32,(ix4 - 1 + min_ihy)*dhy + ohy)
			h[1].gx =  (gx_rot-ogx)*cos(ang2) + (gy_rot-ogy)*sin(ang2) + ogx
			h[1].gy = -(gx_rot-ogx)*sin(ang2) + (gy_rot-ogy)*cos(ang2) + ogy
			h[1].hx =  (hx_rot-ohx)*cos(ang2) + (hy_rot-ohy)*sin(ang2) + ohx
			h[1].hy = -(hx_rot-ohx)*sin(ang2) + (hy_rot-ohy)*cos(ang2) + ohy
			h[1].sx = h[1].gx - h[1].hx
			h[1].sy = h[1].gy - h[1].hy
			h[1].h = sqrt((h[1].hx^2) + (h[1].hy^2))
			h[1].az = rad2deg*atan2((h[1].gy-h[1].sy),(h[1].gx-h[1].sx))
			if (h[1].az < 0)
			    h[1].az += 360.0
			end
			h[1].mx = h[1].sx + h[1].hx/(1 + gammainv)
			h[1].my = h[1].sy + h[1].hy/(1 + gammainv)
			mx_rot = (h[1].mx-omx)*cos(ang2) - (h[1].my-omy)*sin(ang2) + omx
			my_rot = (h[1].mx-omx)*sin(ang2) + (h[1].my-omy)*cos(ang2) + omy
			hx_rot = (h[1].hx-ohx)*cos(ang2) - (h[1].hy-ohy)*sin(ang2) + ohx
			hy_rot = (h[1].hx-ohx)*sin(ang2) + (h[1].hy-ohy)*cos(ang2) + ohy
			h[1].imx = convert(Int32,round((mx_rot-omx)/dmx))
			h[1].imy = convert(Int32,round((my_rot-omy)/dmy))
			h[1].ihx = convert(Int32,round((hx_rot-ohx)/dhx))
			h[1].ihy = convert(Int32,round((hy_rot-ohy)/dhy))
			h[1].ih = convert(Int32,round((h[1].h-oh)/dh))
			h[1].iaz = convert(Int32,round((h[1].az-oaz)/daz))
		    elseif (style=="sxsyhaz")
			error("sxsyhaz not developed yet.")
		    elseif (style=="gxgyhaz")
			error("gxgyhaz not developed yet.")
		    end
		    h[1].selev = convert(typeof(h[1].selev),0)
		    h[1].gelev = convert(typeof(h[1].gelev),0)
		    h[1].trid = convert(typeof(h[1].trid),0)
		    SeisWrite(out,d,h,extent,itrace=j)
		    j += 1
		end
	    end
	end
    end

    DATAPATH = get(ENV,"DATAPATH",join([pwd(),"/"]))
    out_d = join([DATAPATH out "@data@"])
    out_h = join([DATAPATH out "@headers@"])

    for ipatch = 1 : length(patch_names)

   println("ipatch= ",ipatch," ",patch_names[ipatch])
	stream_d = open(out_d,"a+")
	stream_h = open(out_h,"a+")

	d_patch,h_patch,e_patch = SeisRead(patch_names[ipatch])

	nx_patch=e_patch.n2*e_patch.n3*e_patch.n4*e_patch.n5

	nt_patch = h_patch[1].n1

	d_patch=reshape(d_patch,Int(nt_patch),Int(nx_patch))

	ot_patch = h_patch[1].o1
	min_it_patch = Int(floor((ot_patch-ot)/dt)+1)
	max_it_patch = Int(floor((ot_patch-ot)/dt)+nt_patch)

	min_ix1_patch = getfield(h_patch[1],Symbol(key[2]))
	max_ix1_patch = getfield(h_patch[nx_patch],Symbol(key[2]))
	min_ix2_patch = getfield(h_patch[1],Symbol(key[3]))
	max_ix2_patch = getfield(h_patch[nx_patch],Symbol(key[3]))
	min_ix3_patch = getfield(h_patch[1],Symbol(key[4]))
	max_ix3_patch = getfield(h_patch[nx_patch],Symbol(key[4]))
	min_ix4_patch = getfield(h_patch[1],Symbol(key[5]))
	max_ix4_patch = getfield(h_patch[nx_patch],Symbol(key[5]))

	tapti  =  min_it_patch >       1 ? it_WO  : 0
	taptf  =  max_it_patch <      nt ? it_WO  : 0
	tapx1i = min_ix1_patch > min_ix1 ? ix1_WO : 0
	tapx1f = max_ix1_patch < max_ix1 ? ix1_WO : 0
	tapx2i = min_ix2_patch > min_ix2 ? ix2_WO : 0
	tapx2f = max_ix2_patch < max_ix2 ? ix2_WO : 0
	tapx3i = min_ix3_patch > min_ix3 ? ix3_WO : 0
	tapx3f = max_ix3_patch < max_ix3 ? ix3_WO : 0
	tapx4i = min_ix4_patch > min_ix4 ? ix4_WO : 0
	tapx4f = max_ix4_patch < max_ix4 ? ix4_WO : 0

	d_patch = Taper(d_patch,
                        max_it_patch  -  min_it_patch + 1,
		        max_ix1_patch - min_ix1_patch + 1,
		        max_ix2_patch - min_ix2_patch + 1,
		        max_ix3_patch - min_ix3_patch + 1,
		        max_ix4_patch - min_ix4_patch + 1,
		        tapti,taptf,tapx1i,tapx1f,tapx2i,tapx2f,tapx3i,tapx3f,tapx4i,tapx4f)

	for j = 1 : nx_patch

	    h = h_patch[j]
	    if (style=="sxsygxgy")
        itrace = (h.igy - min_igy)*nx3*nx2*nx1 + (h.igx - min_igx)*nx2*nx1 + (h.isy - min_isy)*nx1 + h.isx - min_isx + 1
	    elseif (style=="mxmyhxhy")
          itrace = (h.ihy - min_ihy)*nx3*nx2*nx1 + (h.ihx - min_ihx)*nx2*nx1 + (h.imy - min_imy)*nx1 + h.imx - min_imx + 1
	    elseif (style=="mxmyhaz")
		      itrace = (h.imx - min_imx)*nx2*nx3*nx4 + (h.imy - min_imy)*nx3*nx4 + (h.ih - min_ih)*nx4 + h.iaz - min_iaz + 1

	    elseif (style=="sxsyhxhy")
		      itrace = (h.isx - min_isx)*nx2*nx3*nx4 + (h.isy - min_isy)*nx3*nx4 + (h.ihx - min_ihx)*nx4 + h.ihy - min_ihy + 1
	    elseif (style=="gxgyhxhy")
		      itrace = (h.igx - min_igx)*nx2*nx3*nx4 + (h.igy - min_igy)*nx3*nx4 + (h.ihx - min_ihx)*nx4 + h.ihy - min_ihy + 1
	    elseif (style=="sxsyhaz")
		      itrace = (h.isx - min_isx)*nx2*nx3*nx4 + (h.isy - min_isy)*nx3*nx4 + (h.ih - min_ih)*nx4 + h.iaz - min_iaz + 1
	    elseif (style=="gxgyhaz")
		      itrace = (h.igx - min_igx)*nx2*nx3*nx4 + (h.igy - min_igy)*nx3*nx4 + (h.ih - min_ih)*nx4 + h.iaz - min_iaz + 1
	    end

      if j==1
        println(min_it_patch," ",max_it_patch," ",nt," ",nx_patch," ",ipatch," ",size(d_patch))
      end

      h.tracenum = itrace
	    h.n1 = nt
	    h.o1 = ot
	    position_d = 4*nt*(itrace - 1)
	    seek(stream_d,position_d)
	    d = read(stream_d,Float32,nt)
	    d[min_it_patch:max_it_patch] += d_patch[:,j]

	    seek(stream_d,position_d)
	    write(stream_d,d)
	    PutHeader(stream_h,h,itrace)
	end
	close(stream_d)
	close(stream_h)
    end

end

function Taper(d,nt,nx1,nx2,nx3,nx4,tapti,taptf,tapx1i,tapx1f,tapx2i,tapx2f,tapx3i,tapx3f,tapx4i,tapx4f)
    tx1=1; tx2=1; tx3=1; tx4=1
stream1=open("salida.txt","a")
stream2=open("salida2.txt","a")

    for ix1 = 1 : nx1
	     if (ix1>=1   && ix1<=tapx1i)
	        tx1 = 1.0/(tapx1i-1)*(ix1-1)
	     end
	     if (ix1>tapx1i && ix1<=nx1-tapx1f)
	        tx1 = 1
	     end
	     if (ix1>nx1-tapx1f && ix1<=nx1)
	        tx1 = 1-1.0/(tapx1f-1)*(ix1-1-nx1+tapx1f)
	     end
	     for ix2 = 1 : nx2
	        if (ix2>=1   && ix2<=tapx2i)
		          tx2 = 1.0/(tapx2i-1)*(ix2-1)
	        end
	        if (ix2>tapx2i && ix2<=nx2-tapx2f)
		          tx2 = 1
	        end
	        if (ix2>nx2-tapx2f && ix2<=nx2)
		          tx2 = 1-1.0/(tapx2f-1)*(ix2-1-nx2+tapx2f)
	        end
	        for ix3 = 1 : nx3
		          if (ix3>=1   && ix3<=tapx3i)
		              tx3 = 1.0/(tapx3i-1)*(ix3-1)
		          end
		          if (ix3>tapx3i && ix3<=nx3-tapx3f)
		              tx3 = 1
		          end
		          if (ix3>nx3-tapx3f && ix3<=nx3)
		              tx3 = 1-1.0/(tapx3f-1)*(ix3-1-nx3+tapx3f)
              end
		          for ix4 = 1 : nx4
		              if (ix4>=1   && ix4<=tapx4i)
			                 tx4 = 1.0/(tapx4i-1)*(ix4-1)
		              end
		              if (ix4>tapx4i && ix4<=nx4-tapx4f)
			                 tx4 = 1
		              end
		              if (ix4>nx4-tapx4f && ix4<=nx4)
                      tx4 = 1-1.0/(tapx4f-1)*(ix4-1-nx4+tapx4f)
		              end
		    ix = (ix4-1)*nx2*nx3*nx1 + (ix3-1)*nx1*nx2 + (ix2-1)*nx1 + ix1
		    for it = 1 : nt
			       if (it>=1 && it<=tapti)
			            tt = 1.0/(tapti-1)*(it-1)
			       end
			       if (it>tapti && it<=nt-taptf)
			          tt = 1
			      end
			      if (it>nt-taptf && it<=nt)
			          tt = 1-1.0/(taptf-1)*(it-1-nt+taptf)
			      end
			         d[it,ix] = tt*tx1*tx2*tx3*tx4*d[it,ix]
		    end
		end
	 end
	end
 end
 return d
end


text:
using Test
using CGDycore

# include("DyCore/TestHill.jl")
# include("Grid/TestAnnulusGrid.jl")
# include("Grid/TestCart.jl")
# include("Grid/TestInputGrid.jl")
# include("Grid/TestJacobi.jl")


text:
using MathProgBase

########################################################
## this code is based on ModelReader in NLPModels
## and KNITRO.jl
########################################################

export OnePhaseSolver #, OnePhaseMathProgModel, NonlinearModel

mutable struct OnePhaseSolver <: MathProgBase.AbstractMathProgSolver
    options
end
OnePhaseSolver(;kwargs...) = OnePhaseSolver(kwargs)

type OnePhaseProblem
    status::Symbol  # Final status

    # For MathProgBase
    x::Vector{Float64}  # Starting and final solution
    lambda::Vector{Float64}
    g::Vector{Float64}  # Final constraint values
    obj_val::Float64  # (length 1) Final objective
    solve_time::Float64

    # Custom attributes of the OnePhaseSolver
    iter::Class_iterate
    hist::Array{alg_history2,1}
    pars::Class_parameters

    function OnePhaseProblem()
        return new()
    end
end

########################################################
## BEGIN ModelReader CODE (with minor edits)
########################################################

mutable struct OnePhaseMathProgModel <: MathProgBase.AbstractMathProgModel
  options
  inner::OnePhaseProblem

  eval :: Union{MathProgBase.AbstractNLPEvaluator, Void}
  numVar :: Int
  numConstr :: Int
  x :: Vector{Float64}
  y :: Vector{Float64}
  lvar :: Vector{Float64}
  uvar :: Vector{Float64}
  lcon :: Vector{Float64}
  ucon :: Vector{Float64}
  sense :: Symbol
  status :: Symbol
end

MathProgBase.NonlinearModel(solver :: OnePhaseSolver) = OnePhaseMathProgModel(solver.options,OnePhaseProblem(),nothing,
                                                                   0,
                                                                   0,
                                                                   Float64[],
                                                                   Float64[],
                                                                   Float64[],
                                                                   Float64[],
                                                                   Float64[],
                                                                   Float64[],
                                                                   :Min,
                                                                   :Uninitialized)

function MathProgBase.loadproblem!(m :: OnePhaseMathProgModel,
                                   numVar, numConstr,
                                   l, u, lb, ub,
                                   sense,
                                   eval :: MathProgBase.AbstractNLPEvaluator)

  # TODO: :JacVec is not yet available.
  # [:Grad, :Jac, :JacVec, :Hess, :HessVec, :ExprGraph]
  MathProgBase.initialize(eval, [:Grad, :Jac, :Hess, :HessVec, :ExprGraph])
  m.numVar = numVar
  m.numConstr = numConstr
  m.x = zeros(numVar)
  m.y = zeros(numConstr)
  m.eval = eval
  m.lvar = l
  m.uvar = u
  m.lcon = lb
  m.ucon = ub
  m.sense = sense
end

MathProgBase.setwarmstart!(m :: OnePhaseMathProgModel, x) = (m.x = x)
MathProgBase.status(m :: OnePhaseMathProgModel) = m.inner.status
MathProgBase.getsolution(m :: OnePhaseMathProgModel) = m.inner.x
MathProgBase.getobjval(m :: OnePhaseMathProgModel) = m.inner.iter.cache.fval
#MathProgBase.eval_f(m.eval, m.x)

mutable struct MathProgNLPModel <: AbstractNLPModel
  meta :: NLPModelMeta
  mpmodel :: OnePhaseMathProgModel
  counters :: Counters      # Evaluation counters.

  jrows :: Vector{Int}      # Jacobian sparsity pattern.
  jcols :: Vector{Int}
  jvals :: Vector{Float64}  # Room for the constraints Jacobian.

  hrows :: Vector{Int}      # Hessian sparsity pattern.
  hcols :: Vector{Int}
  hvals :: Vector{Float64}  # Room for the Lagrangian Hessian.
end

"Construct a `MathProgNLPModel` from a `OnePhaseMathProgModel`."
function MathProgNLPModel(mpmodel :: OnePhaseMathProgModel; name :: String="Generic")

  nvar = mpmodel.numVar
  lvar = mpmodel.lvar
  uvar = mpmodel.uvar

  nlin = length(mpmodel.eval.m.linconstr)         # Number of linear constraints.
  nquad = length(mpmodel.eval.m.quadconstr)       # Number of quadratic constraints.
  nnln = length(mpmodel.eval.m.nlpdata.nlconstr)  # Number of nonlinear constraints.
  ncon = mpmodel.numConstr                        # Total number of constraints.
  lcon = mpmodel.lcon
  ucon = mpmodel.ucon

  jrows, jcols = MathProgBase.jac_structure(mpmodel.eval)
  hrows, hcols = MathProgBase.hesslag_structure(mpmodel.eval)
  nnzj = length(jrows)
  nnzh = length(hrows)

  meta = NLPModelMeta(nvar,
                      x0=mpmodel.x,
                      lvar=lvar,
                      uvar=uvar,
                      ncon=ncon,
                      y0=zeros(ncon),
                      lcon=lcon,
                      ucon=ucon,
                      nnzj=nnzj,
                      nnzh=nnzh,
                      lin=collect(1:nlin),  # linear constraints appear first in MPB
                      nln=collect(nlin+1:ncon),
                      minimize=(mpmodel.sense == :Min),
                      islp=MathProgBase.isobjlinear(mpmodel.eval) & (nlin == ncon),
                      name=name,
                      )

  return MathProgNLPModel(meta,
                      mpmodel,
                      Counters(),
                      jrows,
                      jcols,
                      zeros(nnzj),  # jvals
                      hrows,
                      hcols,
                      zeros(nnzh),  # hvals
                      )
end

##
import Base.show
show(nlp :: MathProgNLPModel) = show(nlp.mpmodel)

function obj(nlp :: MathProgNLPModel, x :: Array{Float64})
  NLPModels.increment!(nlp, :neval_obj)
  return MathProgBase.eval_f(nlp.mpmodel.eval, x)
end

function grad(nlp :: MathProgNLPModel, x :: Array{Float64})
  g = zeros(nlp.meta.nvar)
  return grad!(nlp, x, g)
end

function grad!(nlp :: MathProgNLPModel, x :: Array{Float64}, g :: Array{Float64})
  NLPModels.increment!(nlp, :neval_grad)
  MathProgBase.eval_grad_f(nlp.mpmodel.eval, g, x)
  return g
end

function cons(nlp :: MathProgNLPModel, x :: Array{Float64})
  c = zeros(nlp.meta.ncon)
  return cons!(nlp, x, c)
end

function cons!(nlp :: MathProgNLPModel, x :: Array{Float64}, c :: Array{Float64})
  NLPModels.increment!(nlp, :neval_cons)
  MathProgBase.eval_g(nlp.mpmodel.eval, c, x)
  return c
end

function jac_coord(nlp :: MathProgNLPModel, x :: Array{Float64})
  NLPModels.increment!(nlp, :neval_jac)
  MathProgBase.eval_jac_g(nlp.mpmodel.eval, nlp.jvals, x)
  return (nlp.jrows, nlp.jcols, nlp.jvals)
end

function jac(nlp :: MathProgNLPModel, x :: Array{Float64})
  return sparse(jac_coord(nlp, x)..., nlp.meta.ncon, nlp.meta.nvar)
end

function jprod(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64})
  Jv = zeros(nlp.meta.ncon)
  return jprod!(nlp, x, v, Jv)
end

function jprod!(nlp :: MathProgNLPModel,
                x :: Array{Float64},
                v :: Array{Float64},
                Jv :: Array{Float64})
  nlp.counters.neval_jac -= 1
  NLPModels.increment!(nlp, :neval_jprod)
  Jv[:] = jac(nlp, x) * v
  return Jv
end

function jtprod(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64})
  Jtv = zeros(nlp.meta.nvar)
  return jtprod!(nlp, x, v, Jtv)
end

function jtprod!(nlp :: MathProgNLPModel,
                x :: Array{Float64},
                v :: Array{Float64},
                Jtv :: Array{Float64})
  nlp.counters.neval_jac -= 1
  NLPModels.increment!(nlp, :neval_jtprod)
  Jtv[1:nlp.meta.nvar] = jac(nlp, x)' * v
  return Jtv
end

# Uncomment if/when :JacVec becomes available in MPB.
# "Evaluate the Jacobian-vector product at `x`."
# function jprod(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64})
#   jv = zeros(nlp.meta.ncon)
#   return jprod!(nlp, x, v, jv)
# end
#
# "Evaluate the Jacobian-vector product at `x` in place."
# function jprod!(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64}, jv :: Array{Float64})
#   NLPModels.increment!(nlp, :neval_jprod)
#   MathProgBase.eval_jac_prod(nlp.mpmodel.eval, jv, x, v)
#   return jv
# end
#
# "Evaluate the transposed-Jacobian-vector product at `x`."
# function jtprod(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64})
#   jtv = zeros(nlp.meta.nvar)
#   return jtprod!(nlp, x, v, jtv)
# end
#
# "Evaluate the transposed-Jacobian-vector product at `x` in place."
# function jtprod!(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64}, jtv :: Array{Float64})
#   NLPModels.increment!(nlp, :neval_jtprod)
#   MathProgBase.eval_jac_prod_t(nlp.mpmodel.eval, jtv, x, v)
#   return jtv
# end

function hess_coord(nlp :: MathProgNLPModel, x :: Array{Float64};
    obj_weight :: Float64=1.0, y :: Array{Float64}=zeros(nlp.meta.ncon))
  NLPModels.increment!(nlp, :neval_hess)
  MathProgBase.eval_hesslag(nlp.mpmodel.eval, nlp.hvals, x, obj_weight, y)
  return (nlp.hrows, nlp.hcols, nlp.hvals)
end

function hess(nlp :: MathProgNLPModel, x :: Array{Float64};
    obj_weight :: Float64=1.0, y :: Array{Float64}=zeros(nlp.meta.ncon))
  return sparse(hess_coord(nlp, x, y=y, obj_weight=obj_weight)..., nlp.meta.nvar, nlp.meta.nvar)
end

function hprod(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64};
    obj_weight :: Float64=1.0, y :: Array{Float64}=zeros(nlp.meta.ncon))
  hv = zeros(nlp.meta.nvar)
  return hprod!(nlp, x, v, hv, obj_weight=obj_weight, y=y)
end

function hprod!(nlp :: MathProgNLPModel, x :: Array{Float64}, v :: Array{Float64},
    hv :: Array{Float64};
    obj_weight :: Float64=1.0, y :: Array{Float64}=zeros(nlp.meta.ncon))
  NLPModels.increment!(nlp, :neval_hprod)
  MathProgBase.eval_hesslag_prod(nlp.mpmodel.eval, hv, x, v, obj_weight, y)
  return hv
end

############################
## END ModelReader CODE
############################

function status_One_Phase_To_JuMP(status::Symbol)
    # since our status are not equal to JuMPs we need to do a conversion
    if status == :Optimal
        return :Optimal
    elseif status == :primal_infeasible
        return :Infeasible
    elseif status == :dual_infeasible
        return :Unbounded
    elseif status == :MAX_IT || status === :MAX_TIME
        return :UserLimit
    else
        return :Error
    end
end

function create_pars_JuMP(options )
    pars = Class_parameters()
    for (param,value) in options
      what = split(String(param),"!") # we represent a parameter such as init.mu_scale as init!mu_scale because we cannot pass init.mu_scale as a parameter
      node = pars # root
      for i in 1:length(what)
          field = what[i]
          if i < length(what)
              node = getfield(node,Symbol(field))
          else # at the leaf
              setfield!(node,Symbol(field),value)
          end
      end
    end

    return pars
end

function MathProgBase.optimize!(m :: OnePhaseMathProgModel)
    t = time()
    nlp = MathProgNLPModel(m)

    pars = create_pars_JuMP(m.options)

    iter, status, hist, t, err, timer = one_phase_solve(nlp,pars)

    m.inner.status = status_One_Phase_To_JuMP(status)
    m.inner.x = get_original_x(iter)
    m.inner.obj_val = iter.cache.fval
    m.inner.lambda = get_y(iter)
    m.inner.solve_time = time() - t

    # custom one phase features
    m.inner.pars = pars
    m.inner.iter = iter
    m.inner.hist = hist
end

MathProgBase.getconstrsolution(m::OnePhaseMathProgModel) = m.inner.g
MathProgBase.getrawsolver(m::OnePhaseMathProgModel) = m.inner
MathProgBase.getsolvetime(m::OnePhaseMathProgModel) = m.inner.solve_time

function MathProgBase.getreducedcosts(m::OnePhaseMathProgModel)
    return get_reducedcosts(m.inner.iter)
end

function MathProgBase.getconstrduals(m::OnePhaseMathProgModel)
    return get_constrduals(m.inner.iter)
end

#setvartype!(m::OnePhaseMathProgModel, typ::Vector{Symbol}) =
#    (m.varType = map(t->rev_var_type_map[t], typ))

function MathProgBase.freemodel!(m::OnePhaseMathProgModel)
    # TO DO
end


text:
"""
    generate_raw_moment_eqs(rn::Union{ReactionSystem, ReactionSystemMod}, m_order::Int; combinatoric_ratelaw = true)

Given a [`ReactionSystem`](https://catalyst.sciml.ai/stable/api/catalyst_api/#ModelingToolkit.ReactionSystem)
or [`ReactionSystemMod`](@ref), return the [`RawMomentEquations`](@ref) of the system generated up to `m_order`.

Notes:
- The expansion order ``q``, denoted by `q_order` throughout the docs, is automatically
  determined from the given polynomial form of the propensity functions, see the
  [tutorial](@ref main_tutorial) and the [theory section](@ref raw_moment_eqs) for
  more details on how `q_order` is obtained.
- `combinatoric_ratelaw=true` uses binomials in calculating the propensity functions
  of a `ReactionSystem`, see the notes for [`ModelingToolkit.jumpratelaw`]
  (https://mtk.sciml.ai/stable/systems/ReactionSystem/#ModelingToolkit.jumpratelaw).
  *Note* that this field is irrelevant using `ReactionSystemMod` as then the
  propensities are defined directly by the user.
"""
function generate_raw_moment_eqs(rn::Union{ReactionSystem,ReactionSystemMod},
                                 m_order::Int; combinatoric_ratelaw = true)

    N = numspecies(rn)
    S = get_S_mat(rn)
    a = propensities(rn, combinatoric_ratelaw = combinatoric_ratelaw)

    term_factors, term_powers, poly_order = polynomial_propensities(a, rn)

    q_order = poly_order + m_order - 1

    # iterator over all moments from lowest to highest moment order
    iter_all = construct_iter_all(N, q_order)
    # iterator over raw moments up to order m
    iter_m = filter(x -> 1 < sum(x) <= m_order, iter_all)
    # iterator over raw moments of order rgrater than m up to q_order
    iter_q = filter(x -> m_order < sum(x) <= q_order, iter_all)
    # iterator over the first order moments
    iter_1 = filter(x -> sum(x) == 1, iter_all)

    μ = define_μ(N, q_order)

    dμ = Dict()
    for i in vcat(iter_1, iter_m)
        dμ[i] = 0
        for r = 1:numreactions(rn)
            iter_j = filter(x -> all(x .<= i) && sum(x) <= sum(i) - 1, iter_all)
            for j in iter_j
                factor_j = 1.0
                for k = 1:N
                    factor_j *= expected_coeff(S[k, r], i[k] - j[k]) * binomial(i[k], j[k])
                end
                suma = 0.0
                for k = 1:length(term_factors[r])
                    suma += term_factors[r][k] * μ[j.+Tuple(term_powers[r][k])]
                end
                dμ[i] += factor_j * suma
            end
        end
        dμ[i] = expand(dμ[i])
    end

    D = Differential(rn.iv)
    eqs = Equation[]
    for i in vcat(iter_1, iter_m)
        push!(eqs, D(μ[i]) ~ dμ[i])
    end

    vars = extract_variables(eqs, N, q_order)
    odes = ODESystem(eqs, rn.iv, vars, rn.ps)

    RawMomentEquations(
        odes,
        μ,
        N,
        m_order,
        q_order,
        iter_all,
        iter_m,
        iter_q,
        iter_1,
    )

end


text:
mutable struct Setup
    y::FLOATMAT # T x p
    m::FLOATMAT # dp + 1 x p
    P::FLOATMAT # dp + 1 x dp + 1
    S::FLOATMAT # p x p
    β::Real
    δ::Real
    function Setup(y, m, P, S, β, δ)
        str = "y is $(size(y, 1)) x $(size(y, 2)),\nm is $(size(m, 1)) x $(size(m, 2)),\nP is $(size(P, 1)) x $(size(P, 2)), \nS is $(size(S, 1)) x $(size(S, 2))."

        !(size(m, 1) == size(P, 1) == size(P, 2)) && throw(DimensionMismatch(str))
        !(size(y, 2) == size(m, 2) == size(S, 1) == size(S, 2)) && throw(DimensionMismatch(str))

        any(diag(S) .<= 0) && throw(ArgumentError("The diagonal elements of S must be strictly positive."))
        any(diag(P) .<= 0) && throw(ArgumentError("The diagonal elements of P must be strictly positive."))

        (δ  > 0 && δ <= 1) || throw(ArgumentError("0 < δ ≤ 1 required (currently $δ)."))
        (β > 2/3 && β < 1) || throw(ArgumentError("$(2//3) < β < 1 required (currently $β)."))
        return new(y, m, P, S, β, δ)
    end
end

mutable struct Estimation
    y::FLOATMAT # T x p
    m::FLOATARR # T x dp + 1 x p
    P::FLOATARR # T x dp + 1 x dp + 1
    S::FLOATARR # T x p x p
    μ::FLOATMAT # T x p
    Σ::FLOATARR # T x p x p
    e::FLOATMAT # T x p
    u::FLOATMAT # T x p
    ν::Real
    β::Real
    δ::Real
end

mutable struct Simulation
    y::FLOATMAT # T x p
    Ω::FLOATARR # T x dp + 1 x p
    m::FLOATMAT # dp + 1 x p
    P::FLOATMAT # dp + 1 x dp + 1
    S::FLOATMAT # p x p
    T::Integer
    function Simulation(m, P, S, T)
        str = "y is $T x $(size(m, 2)),\nm is $(size(m, 1)) x $(size(m, 2)),\nP is $(size(P, 1)) x $(size(P, 2)), \nS is $(size(S, 1)) x $(size(S, 2))."

        y = zeros(T, size(m, 2))
        Ω = zeros(T, size(m, 1), size(m, 2))

        !(size(m, 1) == size(P, 1) == size(P, 2)) && throw(DimensionMismatch(str))
        !(size(m, 2) == size(S, 1) == size(S, 2)) && throw(DimensionMismatch(str))

        any(diag(S) .<= 0) && throw(ArgumentError("The diagonal elements of S must be strictly positive."))
        any(diag(P) .<= 0) && throw(ArgumentError("The diagonal elements of P must be strictly positive."))

        return new(y, Ω, m, P, S, T)
    end
end


text:
println("HELLO from ", ENV["SERVER_ID"])

server_id = parse(Integer, ENV["SERVER_ID"])

using Logging

logger = SimpleLogger(stdout, Logging.Debug)
global_logger(logger)

using Pkg
Pkg.status()
Pkg.activate(".")
Pkg.instantiate()

using Pidoh
using LightGraphs, SimpleWeightedGraphs
using SparseArrays

experiment = loadexperiment("./data.jld2")
run(experiment, server_id)


text:
import Base: *, +, -, /

##################
# Multiplication #
##################

# The below needs to be defined more generically;
# the below only defines multiplication on orthonormal,
# N<3 objects

typealias OrthonormalBasis{S<:Orthonormal} AbstractBasis{S}

# bra * ket -> scalar
function *{B<:OrthonormalBasis}(bra::DualVector{B}, ket::AbstractQuVector{B})
    return dot(rawcoeffs(bra), rawcoeffs(ket))
end

# bra * operator -> bra
function *{B<:OrthonormalBasis}(bra::DualVector{B}, op::AbstractQuMatrix{B})
    return QuArray(Ac_mul_B(rawcoeffs(op), rawcoeffs(bra)), bases(op,2))'
end

function *{B<:OrthonormalBasis}(bra::DualVector{B}, op::DualMatrix{B})
    return QuArray(rawcoeffs(op)*rawcoeffs(bra), bases(op,2))'
end

# operator * ket -> ket
function *{B<:OrthonormalBasis}(op::AbstractQuMatrix{B}, ket::AbstractQuVector{B})
    vc = rawcoeffs(op)*rawcoeffs(ket)
    QAT = similar_type(typeof(ket))
    return QAT(vc, bases(op,1))
end

function *{B<:OrthonormalBasis}(op::DualMatrix{B}, ket::AbstractQuVector{B})
    vc = Ac_mul_B(rawcoeffs(op), rawcoeffs(ket))
    QAT = similar_type(typeof(ket))
    return QAT(vc, bases(op,1))
end

# ket * bra -> operator
function *{B<:OrthonormalBasis}(ket::QuVector{B}, bra::DualVector{B})
    return QuArray(A_mul_Bc(rawcoeffs(ket), rawcoeffs(bra)),
                   bases(ket,1),
                   bases(bra,1))
end

# operator * operator -> operator
*(dm1::DualMatrix, dm2::DualMatrix) = (dm2.qarr*dm1.qarr)'
*{B<:OrthonormalBasis}(dm1::DualMatrix{B}, dm2::DualMatrix{B}) = (dm2.qarr*dm1.qarr)'

function *{B<:OrthonormalBasis}(dm::DualMatrix{B}, qm::AbstractQuMatrix{B})
    mc = Ac_mul_B(rawcoeffs(dm), rawcoeffs(qm))
    QAT = similar_type(typeof(qm))
    return QAT(mc, bases(dm,1), bases(qm,2))
end

function *{B<:OrthonormalBasis}(qm::AbstractQuMatrix{B}, dm::DualMatrix{B})
    mc = A_mul_Bc(rawcoeffs(dm), rawcoeffs(qm))
    QAT = similar_type(typeof(qm))
    return QAT(mc, bases(qm,1), bases(dm,2))
end

function *{B<:OrthonormalBasis}(qm1::AbstractQuMatrix{B}, qm2::AbstractQuMatrix{B})
    mc = rawcoeffs(qm1)*rawcoeffs(qm2)
    QAT = similar_type(promote_type(typeof(qm1), typeof(qm2)))
    return QAT(mc, bases(qm1,1), bases(qm2,2))
end

# addition and subtraction
function +{B<:AbstractBasis}(qarr1::AbstractQuArray{B}, qarr2::AbstractQuArray{B})
    if bases(qarr1) == bases(qarr2)
        sc = coeffs(qarr1) + coeffs(qarr2)
        QAT = similar_type(promote_type(typeof(qarr1), typeof(qarr2)))
        return QAT(sc, bases(qarr1))
    else
        error("Bases not compatible")
    end
end

function -{B<:AbstractBasis}(qarr1::AbstractQuArray{B}, qarr2::AbstractQuArray{B})
    if bases(qarr1) == bases(qarr2)
        sc = coeffs(qarr1) - coeffs(qarr2)
        QAT = similar_type(promote_type(typeof(qarr1), typeof(qarr2)))
        return QAT(sc, bases(qarr1))
    else
        error("Bases not compatible")
    end
end

+(ct1::CTranspose, ct2::CTranspose) = (ct1.qarr+ct2.qarr)'
-(ct1::CTranspose, ct2::CTranspose) = (ct1.qarr-ct2.qarr)'

# scaling
Base.scale!(num::Number, qarr::AbstractQuArray) = (scale!(num, rawcoeffs(qarr)); return qarr)
Base.scale!(num::Number, ct::CTranspose) = CTranspose(scale!(num', ct.qarr))
Base.scale!(qarr::AbstractQuArray, num::Number) = scale!(num, qarr)

function Base.scale(num::Number, qarr::AbstractQuArray)
    fc = scale(num, rawcoeffs(qarr))
    QAT = QuBase.similar_type(typeof(qarr))
    return QAT(fc, bases(qarr))
end
Base.scale(num::Number, ct::CTranspose) = CTranspose(scale(num', ct.qarr))
Base.scale(qarr::AbstractQuArray, num::Number) = scale(num, qarr)

*(num::Number, qarr::AbstractQuArray) = scale(num, qarr)
*(qarr::AbstractQuArray, num::Number) = scale(qarr, num)
/(qarr::AbstractQuArray, num::Number) = scale(1/num, qarr)

# matrix operations returning a scalar
# normalization
Base.norm(qarr::AbstractQuArray) = vecnorm(rawcoeffs(qarr))

function normalize!(qarr::AbstractQuArray)
    scale!(1/norm(qarr), rawcoeffs(qarr))
    return qarr
end

normalize(qarr::AbstractQuArray) = normalize!(copy(qarr))

# matrix operations returning an array
# sparse to dense
function Base.full(qarr::AbstractQuMatrix)
    fc = full(rawcoeffs(qarr))
    QAT = similar_type(typeof(qarr))
    return QAT(fc, bases(qarr))
end
#Base.full(ct::CTranspose) = full(ct.qarr)'

# exponential of dense matrix
function Base.expm(qarr::AbstractQuMatrix)
    fc = expm(full(rawcoeffs(qarr)))
    QAT = similar_type(typeof(qarr))
    return QAT(fc, bases(qarr))
end
#Base.expm(ct::CTranspose) = expm(ct.qarr)'

##################
# Tensor Product #
##################

# General tensor product definitions for orthonormal bases
function tensor{B<:OrthonormalBasis,T1,T2,N}(qarr1::AbstractQuArray{B,T1,N}, qarr2::AbstractQuArray{B,T2,N})
    tc = kron(coeffs(qarr1), coeffs(qarr2))
    QAT = similar_type(promote_type(typeof(qarr1), typeof(qarr2)))
    return QAT(tc, map(tensor, bases(qarr1), bases(qarr2)))
end

function tensor{B<:OrthonormalBasis,T1,T2,N}(qarr1::CTranspose{B,T1,N}, qarr2::CTranspose{B,T2,N})
    return QuArray(kron(rawcoeffs(qarr1), rawcoeffs(qarr2)),
                   map(tensor, rawbases(qarr1), rawbases(qarr2)))'
end

function tensor{B<:OrthonormalBasis}(ket::QuVector{B}, bra::DualVector{B})
    return QuArray(kron(coeffs(ket), coeffs(bra)),
                   bases(ket,1),
                   bases(bra,1))
end

tensor{B<:OrthonormalBasis}(bra::DualVector{B}, ket::QuVector{B}) = tensor(ket, bra)

###############
# Commutators #
###############

# (anti)commute two QuMatrices and return result
commute(a::AbstractQuMatrix, b::AbstractQuMatrix) = (a*b) - (b*a)
anticommute(a::AbstractQuMatrix, b::AbstractQuMatrix) = (a*b) + (b*a)

export normalize,
    normalize!,
    tensor,
    commute,
    anticommute


text:
# MIT License
# Copyright (c) 2017: Xavier Gandibleux, Anthony Przybylski, Gauthier Soleilhac, and contributors.
struct mono_solution
    mpb::mono_problem
    x::BitArray
    obj::Int
    weight::Int
end

#Constructur : empty solution
# mono_solution(p::mono_problem) = mono_solution(p, falses(size(p)), 0, 0)

obj(s::mono_solution) = s.obj + s.mpb.min_profit_λ
weight(s::mono_solution) = s.weight + s.mpb.ω

#Print function
Base.show(io::IO, s::mono_solution) =
    print(io, "mono_sol(p=$(obj(s)), w=$(weight(s)))")

#Convert a mono_solution to a solution
solution(s::mono_solution) = begin
    #@assert dot(s.pb.w, s.x, s.pb.variables) + s.pb.ω == weight(s)
    p = s.mpb.pb

    C1 = s.mpb.C1
    x = falses(size(p))

    for (i,v) = enumerate(s.mpb.variables)
        s.x[i] && (x[findfirst(isequal(v), p.variables)] = true)
    end

    for v in s.mpb.C1
        x[findfirst(isequal(v), p.variables)] = true
    end

    res = solution(
        p,
        x,
        dot(p.p1, x, p.variables),
        dot(p.p2, x, p.variables),
        weight(s) - p.ω)
    #@assert weight(res) == dot(p.w, res.x, p.variables) + p.ω
    return res
end

max_stars_repo_name: vOptSolver/vOptSpecific

max_issues_repo_name: vOptSolver/vOptSpecific

max_forks_repo_name: vOptSolver/vOptSpecific