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

"""
    associate_tracker_consumer(consumer_arn, tracker_name)
    associate_tracker_consumer(consumer_arn, tracker_name, params::Dict{String,<:Any})

Creates an association between a geofence collection and a tracker resource. This allows
the tracker resource to communicate location data to the linked geofence collection.  You
can associate up to five geofence collections to each tracker resource.  Currently not
supported — Cross-account configurations, such as creating associations between a tracker
resource in one account and a geofence collection in another account.

# Arguments
- `consumer_arn`: The Amazon Resource Name (ARN) for the geofence collection to be
  associated to tracker resource. Used when you need to specify a resource across all AWS.
  Format example:
  arn:aws:geo:region:account-id:geofence-collection/ExampleGeofenceCollectionConsumer
- `tracker_name`: The name of the tracker resource to be associated with a geofence
  collection.

"""
associate_tracker_consumer(ConsumerArn, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/consumers", Dict{String, Any}("ConsumerArn"=>ConsumerArn); aws_config=aws_config)
associate_tracker_consumer(ConsumerArn, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/consumers", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ConsumerArn"=>ConsumerArn), params)); aws_config=aws_config)

"""
    batch_delete_device_position_history(device_ids, tracker_name)
    batch_delete_device_position_history(device_ids, tracker_name, params::Dict{String,<:Any})

Deletes the position history of one or more devices from a tracker resource.

# Arguments
- `device_ids`: Devices whose position history you want to delete.   For example, for two
  devices: “DeviceIds” : [DeviceId1,DeviceId2]
- `tracker_name`: The name of the tracker resource to delete the device position history
  from.

"""
batch_delete_device_position_history(DeviceIds, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/delete-positions", Dict{String, Any}("DeviceIds"=>DeviceIds); aws_config=aws_config)
batch_delete_device_position_history(DeviceIds, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/delete-positions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DeviceIds"=>DeviceIds), params)); aws_config=aws_config)

"""
    batch_delete_geofence(collection_name, geofence_ids)
    batch_delete_geofence(collection_name, geofence_ids, params::Dict{String,<:Any})

Deletes a batch of geofences from a geofence collection.  This operation deletes the
resource permanently.

# Arguments
- `collection_name`: The geofence collection storing the geofences to be deleted.
- `geofence_ids`: The batch of geofences to be deleted.

"""
batch_delete_geofence(CollectionName, GeofenceIds; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/delete-geofences", Dict{String, Any}("GeofenceIds"=>GeofenceIds); aws_config=aws_config)
batch_delete_geofence(CollectionName, GeofenceIds, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/delete-geofences", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("GeofenceIds"=>GeofenceIds), params)); aws_config=aws_config)

"""
    batch_evaluate_geofences(collection_name, device_position_updates)
    batch_evaluate_geofences(collection_name, device_position_updates, params::Dict{String,<:Any})

Evaluates device positions against the geofence geometries from a given geofence
collection. This operation always returns an empty response because geofences are
asynchronously evaluated. The evaluation determines if the device has entered or exited a
geofenced area, and then publishes one of the following events to Amazon EventBridge:
ENTER if Amazon Location determines that the tracked device has entered a geofenced area.
 EXIT if Amazon Location determines that the tracked device has exited a geofenced area.
The last geofence that a device was observed within is tracked for 30 days after the most
recent device position update.

# Arguments
- `collection_name`: The geofence collection used in evaluating the position of devices
  against its geofences.
- `device_position_updates`: Contains device details for each device to be evaluated
  against the given geofence collection.

"""
batch_evaluate_geofences(CollectionName, DevicePositionUpdates; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/positions", Dict{String, Any}("DevicePositionUpdates"=>DevicePositionUpdates); aws_config=aws_config)
batch_evaluate_geofences(CollectionName, DevicePositionUpdates, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/positions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DevicePositionUpdates"=>DevicePositionUpdates), params)); aws_config=aws_config)

"""
    batch_get_device_position(device_ids, tracker_name)
    batch_get_device_position(device_ids, tracker_name, params::Dict{String,<:Any})

Lists the latest device positions for requested devices.

# Arguments
- `device_ids`: Devices whose position you want to retrieve.   For example, for two
  devices: device-ids=DeviceId1&device-ids=DeviceId2
- `tracker_name`: The tracker resource retrieving the device position.

"""
batch_get_device_position(DeviceIds, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/get-positions", Dict{String, Any}("DeviceIds"=>DeviceIds); aws_config=aws_config)
batch_get_device_position(DeviceIds, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/get-positions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DeviceIds"=>DeviceIds), params)); aws_config=aws_config)

"""
    batch_put_geofence(collection_name, entries)
    batch_put_geofence(collection_name, entries, params::Dict{String,<:Any})

A batch request for storing geofence geometries into a given geofence collection, or
updates the geometry of an existing geofence if a geofence ID is included in the request.

# Arguments
- `collection_name`: The geofence collection storing the geofences.
- `entries`: The batch of geofences to be stored in a geofence collection.

"""
batch_put_geofence(CollectionName, Entries; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/put-geofences", Dict{String, Any}("Entries"=>Entries); aws_config=aws_config)
batch_put_geofence(CollectionName, Entries, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/put-geofences", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Entries"=>Entries), params)); aws_config=aws_config)

"""
    batch_update_device_position(tracker_name, updates)
    batch_update_device_position(tracker_name, updates, params::Dict{String,<:Any})

Uploads position update data for one or more devices to a tracker resource. Amazon Location
uses the data when reporting the last known device position and position history.  Only one
position update is stored per sample time. Location data is sampled at a fixed rate of one
position per 30-second interval and retained for 30 days before it's deleted.

# Arguments
- `tracker_name`: The name of the tracker resource to update.
- `updates`: Contains the position update details for each device.

"""
batch_update_device_position(TrackerName, Updates; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/positions", Dict{String, Any}("Updates"=>Updates); aws_config=aws_config)
batch_update_device_position(TrackerName, Updates, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/positions", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Updates"=>Updates), params)); aws_config=aws_config)

"""
    calculate_route(calculator_name, departure_position, destination_position)
    calculate_route(calculator_name, departure_position, destination_position, params::Dict{String,<:Any})

 Calculates a route given the following required parameters: DeparturePostiton and
DestinationPosition. Requires that you first create a route calculator resource  By
default, a request that doesn't specify a departure time uses the best time of day to
travel with the best traffic conditions when calculating the route. Additional options
include:    Specifying a departure time using either DepartureTime or DepartureNow. This
calculates a route based on predictive traffic data at the given time.   You can't specify
both DepartureTime and DepartureNow in a single request. Specifying both parameters returns
an error message.     Specifying a travel mode using TravelMode. This lets you specify an
additional route preference such as CarModeOptions if traveling by Car, or TruckModeOptions
if traveling by Truck.

# Arguments
- `calculator_name`: The name of the route calculator resource that you want to use to
  calculate a route.
- `departure_position`: The start position for the route. Defined in WGS 84 format:
  [longitude, latitude].   For example, [-123.115, 49.285]     If you specify a departure
  that's not located on a road, Amazon Location moves the position to the nearest road.
  Valid Values: [-180 to 180,-90 to 90]
- `destination_position`: The finish position for the route. Defined in WGS 84 format:
  [longitude, latitude].    For example, [-122.339, 47.615]     If you specify a destination
  that's not located on a road, Amazon Location moves the position to the nearest road.
  Valid Values: [-180 to 180,-90 to 90]

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"CarModeOptions"`: Specifies route preferences when traveling by Car, such as avoiding
  routes that use ferries or tolls. Requirements: TravelMode must be specified as Car.
- `"DepartNow"`: Sets the time of departure as the current time. Uses the current time to
  calculate a route. Otherwise, the best time of day to travel with the best traffic
  conditions is used to calculate the route. Default Value: false  Valid Values: false | true
- `"DepartureTime"`: Specifies the desired time of departure. Uses the given time to
  calculate a route. Otherwise, the best time of day to travel with the best traffic
  conditions is used to calculate the route.  Setting a departure time in the past returns a
  400 ValidationException error.    In ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ. For
  example, 2020–07-2T12:15:20.000Z+01:00
- `"DistanceUnit"`: Set the unit system to specify the distance. Default Value: Kilometers
- `"IncludeLegGeometry"`: Set to include the geometry details in the result for each path
  between a pair of positions. Default Value: false  Valid Values: false | true
- `"TravelMode"`: Specifies the mode of transport when calculating a route. Used in
  estimating the speed of travel and road compatibility. The TravelMode you specify
  determines how you specify route preferences:    If traveling by Car use the CarModeOptions
  parameter.   If traveling by Truck use the TruckModeOptions parameter.   Default Value: Car
- `"TruckModeOptions"`: Specifies route preferences when traveling by Truck, such as
  avoiding routes that use ferries or tolls, and truck specifications to consider when
  choosing an optimal road. Requirements: TravelMode must be specified as Truck.
- `"WaypointPositions"`: Specifies an ordered list of up to 23 intermediate positions to
  include along a route between the departure position and destination position.    For
  example, from the DeparturePosition [-123.115, 49.285], the route follows the order that
  the waypoint positions are given [[-122.757, 49.0021],[-122.349, 47.620]]     If you
  specify a waypoint position that's not located on a road, Amazon Location moves the
  position to the nearest road.  Specifying more than 23 waypoints returns a 400
  ValidationException error.  Valid Values: [-180 to 180,-90 to 90]
"""
calculate_route(CalculatorName, DeparturePosition, DestinationPosition; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/routes/v0/calculators/$(CalculatorName)/calculate/route", Dict{String, Any}("DeparturePosition"=>DeparturePosition, "DestinationPosition"=>DestinationPosition); aws_config=aws_config)
calculate_route(CalculatorName, DeparturePosition, DestinationPosition, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/routes/v0/calculators/$(CalculatorName)/calculate/route", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DeparturePosition"=>DeparturePosition, "DestinationPosition"=>DestinationPosition), params)); aws_config=aws_config)

"""
    create_geofence_collection(collection_name, pricing_plan)
    create_geofence_collection(collection_name, pricing_plan, params::Dict{String,<:Any})

Creates a geofence collection, which manages and stores geofences.

# Arguments
- `collection_name`: A custom name for the geofence collection. Requirements:   Contain
  only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and
  underscores (_).    Must be a unique geofence collection name.   No spaces allowed. For
  example, ExampleGeofenceCollection.
- `pricing_plan`: Specifies the pricing plan for the geofence collection. For additional
  details and restrictions on each pricing plan option, see the Amazon Location Service
  pricing page.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: An optional description for the geofence collection.
- `"KmsKeyId"`: A key identifier for an AWS KMS customer managed key. Enter a key ID, key
  ARN, alias name, or alias ARN.
- `"PricingPlanDataSource"`: Specifies the data provider for the geofence collection.
  Required value for the following pricing plans: MobileAssetTracking | MobileAssetManagement
     For more information about Data Providers, and Pricing plans, see the Amazon Location
  Service product page.  Amazon Location Service only uses PricingPlanDataSource to calculate
  billing for your geofence collection. Your data won't be shared with the data provider, and
  will remain in your AWS account or Region unless you move it.  Valid Values: Esri | Here
- `"Tags"`: Applies one or more tags to the geofence collection. A tag is a key-value pair
  helps manage, identify, search, and filter your resources by labelling them. Format:
  \"key\" : \"value\"  Restrictions:   Maximum 50 tags per resource   Each resource tag must
  be unique with a maximum of one value.   Maximum key length: 128 Unicode characters in
  UTF-8   Maximum value length: 256 Unicode characters in UTF-8   Can use alphanumeric
  characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.
"""
create_geofence_collection(CollectionName, PricingPlan; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections", Dict{String, Any}("CollectionName"=>CollectionName, "PricingPlan"=>PricingPlan); aws_config=aws_config)
create_geofence_collection(CollectionName, PricingPlan, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("CollectionName"=>CollectionName, "PricingPlan"=>PricingPlan), params)); aws_config=aws_config)

"""
    create_map(configuration, map_name, pricing_plan)
    create_map(configuration, map_name, pricing_plan, params::Dict{String,<:Any})

Creates a map resource in your AWS account, which provides map tiles of different styles
sourced from global location data providers.

# Arguments
- `configuration`: Specifies the map style selected from an available data provider.
- `map_name`: The name for the map resource. Requirements:   Must contain only alphanumeric
  characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).    Must be
  a unique map resource name.    No spaces allowed. For example, ExampleMap.
- `pricing_plan`: Specifies the pricing plan for your map resource. For additional details
  and restrictions on each pricing plan option, see the Amazon Location Service pricing page.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: An optional description for the map resource.
- `"Tags"`: Applies one or more tags to the map resource. A tag is a key-value pair helps
  manage, identify, search, and filter your resources by labelling them. Format: \"key\" :
  \"value\"  Restrictions:   Maximum 50 tags per resource   Each resource tag must be unique
  with a maximum of one value.   Maximum key length: 128 Unicode characters in UTF-8
  Maximum value length: 256 Unicode characters in UTF-8   Can use alphanumeric characters
  (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.
"""
create_map(Configuration, MapName, PricingPlan; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/maps/v0/maps", Dict{String, Any}("Configuration"=>Configuration, "MapName"=>MapName, "PricingPlan"=>PricingPlan); aws_config=aws_config)
create_map(Configuration, MapName, PricingPlan, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/maps/v0/maps", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Configuration"=>Configuration, "MapName"=>MapName, "PricingPlan"=>PricingPlan), params)); aws_config=aws_config)

"""
    create_place_index(data_source, index_name, pricing_plan)
    create_place_index(data_source, index_name, pricing_plan, params::Dict{String,<:Any})

Creates a place index resource in your AWS account, which supports functions with
geospatial data sourced from your chosen data provider.

# Arguments
- `data_source`: Specifies the data provider of geospatial data.  This field is
  case-sensitive. Enter the valid values as shown. For example, entering HERE returns an
  error.  Valid values include:    Esri – For additional information about Esri's coverage
  in your region of interest, see Esri details on geocoding coverage.    Here – For
  additional information about HERE Technologies's coverage in your region of interest, see
  HERE details on goecoding coverage.  Place index resources using HERE Technologies as a
  data provider can't store results for locations in Japan. For more information, see the AWS
  Service Terms for Amazon Location Service.    For additional information , see Data
  providers on the Amazon Location Service Developer Guide.
- `index_name`: The name of the place index resource.  Requirements:   Contain only
  alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores
  (_).   Must be a unique place index resource name.   No spaces allowed. For example,
  ExamplePlaceIndex.
- `pricing_plan`: Specifies the pricing plan for your place index resource. For additional
  details and restrictions on each pricing plan option, see the Amazon Location Service
  pricing page.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"DataSourceConfiguration"`: Specifies the data storage option requesting Places.
- `"Description"`: The optional description for the place index resource.
- `"Tags"`: Applies one or more tags to the place index resource. A tag is a key-value pair
  helps manage, identify, search, and filter your resources by labelling them. Format:
  \"key\" : \"value\"  Restrictions:   Maximum 50 tags per resource   Each resource tag must
  be unique with a maximum of one value.   Maximum key length: 128 Unicode characters in
  UTF-8   Maximum value length: 256 Unicode characters in UTF-8   Can use alphanumeric
  characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.
"""
create_place_index(DataSource, IndexName, PricingPlan; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/indexes", Dict{String, Any}("DataSource"=>DataSource, "IndexName"=>IndexName, "PricingPlan"=>PricingPlan); aws_config=aws_config)
create_place_index(DataSource, IndexName, PricingPlan, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/indexes", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("DataSource"=>DataSource, "IndexName"=>IndexName, "PricingPlan"=>PricingPlan), params)); aws_config=aws_config)

"""
    create_route_calculator(calculator_name, data_source, pricing_plan)
    create_route_calculator(calculator_name, data_source, pricing_plan, params::Dict{String,<:Any})

Creates a route calculator resource in your AWS account. You can send requests to a route
calculator resource to estimate travel time, distance, and get directions. A route
calculator sources traffic and road network data from your chosen data provider.

# Arguments
- `calculator_name`: The name of the route calculator resource.  Requirements:   Can use
  alphanumeric characters (A–Z, a–z, 0–9) , hyphens (-), periods (.), and underscores
  (_).   Must be a unique Route calculator resource name.   No spaces allowed. For example,
  ExampleRouteCalculator.
- `data_source`: Specifies the data provider of traffic and road network data.  This field
  is case-sensitive. Enter the valid values as shown. For example, entering HERE returns an
  error.  Valid values include:    Esri – For additional information about Esri's coverage
  in your region of interest, see Esri details on street networks and traffic coverage.
  Here – For additional information about HERE Technologies's coverage in your region of
  interest, see HERE car routing coverage and HERE truck routing coverage.   For additional
  information , see Data providers on the Amazon Location Service Developer Guide.
- `pricing_plan`: Specifies the pricing plan for your route calculator resource. For
  additional details and restrictions on each pricing plan option, see Amazon Location
  Service pricing.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: The optional description for the route calculator resource.
- `"Tags"`: Applies one or more tags to the route calculator resource. A tag is a key-value
  pair helps manage, identify, search, and filter your resources by labelling them.   For
  example: { \"tag1\" : \"value1\", \"tag2\" : \"value2\"}   Format: \"key\" : \"value\"
  Restrictions:   Maximum 50 tags per resource   Each resource tag must be unique with a
  maximum of one value.   Maximum key length: 128 Unicode characters in UTF-8   Maximum value
  length: 256 Unicode characters in UTF-8   Can use alphanumeric characters (A–Z, a–z,
  0–9), and the following characters: + - = . _ : / @.
"""
create_route_calculator(CalculatorName, DataSource, PricingPlan; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/routes/v0/calculators", Dict{String, Any}("CalculatorName"=>CalculatorName, "DataSource"=>DataSource, "PricingPlan"=>PricingPlan); aws_config=aws_config)
create_route_calculator(CalculatorName, DataSource, PricingPlan, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/routes/v0/calculators", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("CalculatorName"=>CalculatorName, "DataSource"=>DataSource, "PricingPlan"=>PricingPlan), params)); aws_config=aws_config)

"""
    create_tracker(pricing_plan, tracker_name)
    create_tracker(pricing_plan, tracker_name, params::Dict{String,<:Any})

Creates a tracker resource in your AWS account, which lets you retrieve current and
historical location of devices.

# Arguments
- `pricing_plan`: Specifies the pricing plan for the tracker resource. For additional
  details and restrictions on each pricing plan option, see the Amazon Location Service
  pricing page.
- `tracker_name`: The name for the tracker resource. Requirements:   Contain only
  alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-), periods (.), and underscores (_).
  Must be a unique tracker resource name.   No spaces allowed. For example, ExampleTracker.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: An optional description for the tracker resource.
- `"KmsKeyId"`: A key identifier for an AWS KMS customer managed key. Enter a key ID, key
  ARN, alias name, or alias ARN.
- `"PricingPlanDataSource"`: Specifies the data provider for the tracker resource.
  Required value for the following pricing plans: MobileAssetTracking | MobileAssetManagement
     For more information about Data Providers, and Pricing plans, see the Amazon Location
  Service product page.  Amazon Location Service only uses PricingPlanDataSource to calculate
  billing for your tracker resource. Your data will not be shared with the data provider, and
  will remain in your AWS account or Region unless you move it.  Valid Values: Esri | Here
- `"Tags"`: Applies one or more tags to the tracker resource. A tag is a key-value pair
  helps manage, identify, search, and filter your resources by labelling them. Format:
  \"key\" : \"value\"  Restrictions:   Maximum 50 tags per resource   Each resource tag must
  be unique with a maximum of one value.   Maximum key length: 128 Unicode characters in
  UTF-8   Maximum value length: 256 Unicode characters in UTF-8   Can use alphanumeric
  characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.
"""
create_tracker(PricingPlan, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers", Dict{String, Any}("PricingPlan"=>PricingPlan, "TrackerName"=>TrackerName); aws_config=aws_config)
create_tracker(PricingPlan, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("PricingPlan"=>PricingPlan, "TrackerName"=>TrackerName), params)); aws_config=aws_config)

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

Deletes a geofence collection from your AWS account.  This operation deletes the resource
permanently. If the geofence collection is the target of a tracker resource, the devices
will no longer be monitored.

# Arguments
- `collection_name`: The name of the geofence collection to be deleted.

"""
delete_geofence_collection(CollectionName; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/geofencing/v0/collections/$(CollectionName)"; aws_config=aws_config)
delete_geofence_collection(CollectionName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/geofencing/v0/collections/$(CollectionName)", params; aws_config=aws_config)

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

Deletes a map resource from your AWS account.  This operation deletes the resource
permanently. If the map is being used in an application, the map may not render.

# Arguments
- `map_name`: The name of the map resource to be deleted.

"""
delete_map(MapName; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/maps/v0/maps/$(MapName)"; aws_config=aws_config)
delete_map(MapName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/maps/v0/maps/$(MapName)", params; aws_config=aws_config)

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

Deletes a place index resource from your AWS account.  This operation deletes the resource
permanently.

# Arguments
- `index_name`: The name of the place index resource to be deleted.

"""
delete_place_index(IndexName; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/places/v0/indexes/$(IndexName)"; aws_config=aws_config)
delete_place_index(IndexName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/places/v0/indexes/$(IndexName)", params; aws_config=aws_config)

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

Deletes a route calculator resource from your AWS account.  This operation deletes the
resource permanently.

# Arguments
- `calculator_name`: The name of the route calculator resource to be deleted.

"""
delete_route_calculator(CalculatorName; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/routes/v0/calculators/$(CalculatorName)"; aws_config=aws_config)
delete_route_calculator(CalculatorName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/routes/v0/calculators/$(CalculatorName)", params; aws_config=aws_config)

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

Deletes a tracker resource from your AWS account.  This operation deletes the resource
permanently. If the tracker resource is in use, you may encounter an error. Make sure that
the target resource isn't a dependency for your applications.

# Arguments
- `tracker_name`: The name of the tracker resource to be deleted.

"""
delete_tracker(TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/tracking/v0/trackers/$(TrackerName)"; aws_config=aws_config)
delete_tracker(TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/tracking/v0/trackers/$(TrackerName)", params; aws_config=aws_config)

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

Retrieves the geofence collection details.

# Arguments
- `collection_name`: The name of the geofence collection.

"""
describe_geofence_collection(CollectionName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/geofencing/v0/collections/$(CollectionName)"; aws_config=aws_config)
describe_geofence_collection(CollectionName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/geofencing/v0/collections/$(CollectionName)", params; aws_config=aws_config)

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

Retrieves the map resource details.

# Arguments
- `map_name`: The name of the map resource.

"""
describe_map(MapName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)"; aws_config=aws_config)
describe_map(MapName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)", params; aws_config=aws_config)

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

Retrieves the place index resource details.

# Arguments
- `index_name`: The name of the place index resource.

"""
describe_place_index(IndexName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/places/v0/indexes/$(IndexName)"; aws_config=aws_config)
describe_place_index(IndexName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/places/v0/indexes/$(IndexName)", params; aws_config=aws_config)

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

Retrieves the route calculator resource details.

# Arguments
- `calculator_name`: The name of the route calculator resource.

"""
describe_route_calculator(CalculatorName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/routes/v0/calculators/$(CalculatorName)"; aws_config=aws_config)
describe_route_calculator(CalculatorName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/routes/v0/calculators/$(CalculatorName)", params; aws_config=aws_config)

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

Retrieves the tracker resource details.

# Arguments
- `tracker_name`: The name of the tracker resource.

"""
describe_tracker(TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/tracking/v0/trackers/$(TrackerName)"; aws_config=aws_config)
describe_tracker(TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/tracking/v0/trackers/$(TrackerName)", params; aws_config=aws_config)

"""
    disassociate_tracker_consumer(consumer_arn, tracker_name)
    disassociate_tracker_consumer(consumer_arn, tracker_name, params::Dict{String,<:Any})

Removes the association between a tracker resource and a geofence collection.  Once you
unlink a tracker resource from a geofence collection, the tracker positions will no longer
be automatically evaluated against geofences.

# Arguments
- `consumer_arn`: The Amazon Resource Name (ARN) for the geofence collection to be
  disassociated from the tracker resource. Used when you need to specify a resource across
  all AWS.    Format example:
  arn:aws:geo:region:account-id:geofence-collection/ExampleGeofenceCollectionConsumer
- `tracker_name`: The name of the tracker resource to be dissociated from the consumer.

"""
disassociate_tracker_consumer(ConsumerArn, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/tracking/v0/trackers/$(TrackerName)/consumers/$(ConsumerArn)"; aws_config=aws_config)
disassociate_tracker_consumer(ConsumerArn, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("DELETE", "/tracking/v0/trackers/$(TrackerName)/consumers/$(ConsumerArn)", params; aws_config=aws_config)

"""
    get_device_position(device_id, tracker_name)
    get_device_position(device_id, tracker_name, params::Dict{String,<:Any})

Retrieves a device's most recent position according to its sample time.  Device positions
are deleted after 30 days.

# Arguments
- `device_id`: The device whose position you want to retrieve.
- `tracker_name`: The tracker resource receiving the position update.

"""
get_device_position(DeviceId, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/tracking/v0/trackers/$(TrackerName)/devices/$(DeviceId)/positions/latest"; aws_config=aws_config)
get_device_position(DeviceId, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/tracking/v0/trackers/$(TrackerName)/devices/$(DeviceId)/positions/latest", params; aws_config=aws_config)

"""
    get_device_position_history(device_id, tracker_name)
    get_device_position_history(device_id, tracker_name, params::Dict{String,<:Any})

Retrieves the device position history from a tracker resource within a specified range of
time.  Device positions are deleted after 30 days.

# Arguments
- `device_id`: The device whose position history you want to retrieve.
- `tracker_name`: The tracker resource receiving the request for the device position
  history.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"EndTimeExclusive"`: Specify the end time for the position history in  ISO 8601 format:
  YYYY-MM-DDThh:mm:ss.sssZ. By default, the value will be the time that the request is made.
  Requirement:   The time specified for EndTimeExclusive must be after the time for
  StartTimeInclusive.
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page.  Default value: null
- `"StartTimeInclusive"`: Specify the start time for the position history in  ISO 8601
  format: YYYY-MM-DDThh:mm:ss.sssZ. By default, the value will be 24 hours prior to the time
  that the request is made. Requirement:   The time specified for StartTimeInclusive must be
  before EndTimeExclusive.
"""
get_device_position_history(DeviceId, TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/devices/$(DeviceId)/list-positions"; aws_config=aws_config)
get_device_position_history(DeviceId, TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/devices/$(DeviceId)/list-positions", params; aws_config=aws_config)

"""
    get_geofence(collection_name, geofence_id)
    get_geofence(collection_name, geofence_id, params::Dict{String,<:Any})

Retrieves the geofence details from a geofence collection.

# Arguments
- `collection_name`: The geofence collection storing the target geofence.
- `geofence_id`: The geofence you're retrieving details for.

"""
get_geofence(CollectionName, GeofenceId; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/geofencing/v0/collections/$(CollectionName)/geofences/$(GeofenceId)"; aws_config=aws_config)
get_geofence(CollectionName, GeofenceId, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/geofencing/v0/collections/$(CollectionName)/geofences/$(GeofenceId)", params; aws_config=aws_config)

"""
    get_map_glyphs(font_stack, font_unicode_range, map_name)
    get_map_glyphs(font_stack, font_unicode_range, map_name, params::Dict{String,<:Any})

Retrieves glyphs used to display labels on a map.

# Arguments
- `font_stack`: A comma-separated list of fonts to load glyphs from in order of preference.
  For example, Noto Sans Regular, Arial Unicode. Valid fonts for Esri styles:
  VectorEsriDarkGrayCanvas – Ubuntu Medium Italic | Ubuntu Medium | Ubuntu Italic | Ubuntu
  Regular | Ubuntu Bold    VectorEsriLightGrayCanvas – Ubuntu Italic | Ubuntu Regular |
  Ubuntu Light | Ubuntu Bold    VectorEsriTopographic – Noto Sans Italic | Noto Sans
  Regular | Noto Sans Bold | Noto Serif Regular | Roboto Condensed Light Italic
  VectorEsriStreets – Arial Regular | Arial Italic | Arial Bold    VectorEsriNavigation –
  Arial Regular | Arial Italic | Arial Bold    Valid fonts for HERE Technologies styles:
  VectorHereBerlin – Fira GO Regular | Fira GO Bold
- `font_unicode_range`: A Unicode range of characters to download glyphs for. Each response
  will contain 256 characters. For example, 0–255 includes all characters from range U+0000
  to 00FF. Must be aligned to multiples of 256.
- `map_name`: The map resource associated with the glyph ﬁle.

"""
get_map_glyphs(FontStack, FontUnicodeRange, MapName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/glyphs/$(FontStack)/$(FontUnicodeRange)"; aws_config=aws_config)
get_map_glyphs(FontStack, FontUnicodeRange, MapName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/glyphs/$(FontStack)/$(FontUnicodeRange)", params; aws_config=aws_config)

"""
    get_map_sprites(file_name, map_name)
    get_map_sprites(file_name, map_name, params::Dict{String,<:Any})

Retrieves the sprite sheet corresponding to a map resource. The sprite sheet is a PNG image
paired with a JSON document describing the offsets of individual icons that will be
displayed on a rendered map.

# Arguments
- `file_name`: The name of the sprite ﬁle. Use the following ﬁle names for the sprite
  sheet:    sprites.png     sprites@2x.png for high pixel density displays   For the JSON
  document contain image offsets. Use the following ﬁle names:    sprites.json
  sprites@2x.json for high pixel density displays
- `map_name`: The map resource associated with the sprite ﬁle.

"""
get_map_sprites(FileName, MapName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/sprites/$(FileName)"; aws_config=aws_config)
get_map_sprites(FileName, MapName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/sprites/$(FileName)", params; aws_config=aws_config)

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

Retrieves the map style descriptor from a map resource.  The style descriptor contains
speciﬁcations on how features render on a map. For example, what data to display, what
order to display the data in, and the style for the data. Style descriptors follow the
Mapbox Style Specification.

# Arguments
- `map_name`: The map resource to retrieve the style descriptor from.

"""
get_map_style_descriptor(MapName; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/style-descriptor"; aws_config=aws_config)
get_map_style_descriptor(MapName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/style-descriptor", params; aws_config=aws_config)

"""
    get_map_tile(map_name, x, y, z)
    get_map_tile(map_name, x, y, z, params::Dict{String,<:Any})

Retrieves a vector data tile from the map resource. Map tiles are used by clients to render
a map. they're addressed using a grid arrangement with an X coordinate, Y coordinate, and Z
(zoom) level.  The origin (0, 0) is the top left of the map. Increasing the zoom level by 1
doubles both the X and Y dimensions, so a tile containing data for the entire world at
(0/0/0) will be split into 4 tiles at zoom 1 (1/0/0, 1/0/1, 1/1/0, 1/1/1).

# Arguments
- `map_name`: The map resource to retrieve the map tiles from.
- `x`: The X axis value for the map tile.
- `y`: The Y axis value for the map tile.
- `z`: The zoom value for the map tile.

"""
get_map_tile(MapName, X, Y, Z; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/tiles/$(Z)/$(X)/$(Y)"; aws_config=aws_config)
get_map_tile(MapName, X, Y, Z, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("GET", "/maps/v0/maps/$(MapName)/tiles/$(Z)/$(X)/$(Y)", params; aws_config=aws_config)

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

A batch request to retrieve all device positions.

# Arguments
- `tracker_name`: The tracker resource containing the requested devices.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional limit for the number of entries returned in a single call.
  Default value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page. Default value: null
"""
list_device_positions(TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/list-positions"; aws_config=aws_config)
list_device_positions(TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/list-positions", params; aws_config=aws_config)

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

Lists geofence collections in your AWS account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional limit for the number of resources returned in a single call.
  Default value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page.  Default value: null
"""
list_geofence_collections(; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/list-collections"; aws_config=aws_config)
list_geofence_collections(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/list-collections", params; aws_config=aws_config)

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

Lists geofences stored in a given geofence collection.

# Arguments
- `collection_name`: The name of the geofence collection storing the list of geofences.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page.  Default value: null
"""
list_geofences(CollectionName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/list-geofences"; aws_config=aws_config)
list_geofences(CollectionName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/geofencing/v0/collections/$(CollectionName)/list-geofences", params; aws_config=aws_config)

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

Lists map resources in your AWS account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional limit for the number of resources returned in a single call.
  Default value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page. Default value: null
"""
list_maps(; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/maps/v0/list-maps"; aws_config=aws_config)
list_maps(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/maps/v0/list-maps", params; aws_config=aws_config)

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

Lists place index resources in your AWS account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional limit for the maximum number of results returned in a single
  call. Default value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page. Default value: null
"""
list_place_indexes(; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/list-indexes"; aws_config=aws_config)
list_place_indexes(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/list-indexes", params; aws_config=aws_config)

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

Lists route calculator resources in your AWS account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional maximum number of results returned in a single call. Default
  Value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page. Default Value: null
"""
list_route_calculators(; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/routes/v0/list-calculators"; aws_config=aws_config)
list_route_calculators(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/routes/v0/list-calculators", params; aws_config=aws_config)

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

Returns a list of tags that are applied to the specified Amazon Location resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource whose tags you want to
  retrieve.   Format example: arn:aws:geo:region:account-id:resourcetype/ExampleResource

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

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

Lists geofence collections currently associated to the given tracker resource.

# Arguments
- `tracker_name`: The tracker resource whose associated geofence collections you want to
  list.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional limit for the number of resources returned in a single call.
  Default value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page.  Default value: null
"""
list_tracker_consumers(TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/list-consumers"; aws_config=aws_config)
list_tracker_consumers(TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/trackers/$(TrackerName)/list-consumers", params; aws_config=aws_config)

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

Lists tracker resources in your AWS account.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional limit for the number of resources returned in a single call.
  Default value: 100
- `"NextToken"`: The pagination token specifying which page of results to return in the
  response. If no token is provided, the default page is the first page.  Default value: null
"""
list_trackers(; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/list-trackers"; aws_config=aws_config)
list_trackers(params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/tracking/v0/list-trackers", params; aws_config=aws_config)

"""
    put_geofence(collection_name, geofence_id, geometry)
    put_geofence(collection_name, geofence_id, geometry, params::Dict{String,<:Any})

Stores a geofence geometry in a given geofence collection, or updates the geometry of an
existing geofence if a geofence ID is included in the request.

# Arguments
- `collection_name`: The geofence collection to store the geofence in.
- `geofence_id`: An identifier for the geofence. For example, ExampleGeofence-1.
- `geometry`: Contains the polygon details to specify the position of the geofence.  Each
  geofence polygon can have a maximum of 1,000 vertices.

"""
put_geofence(CollectionName, GeofenceId, Geometry; aws_config::AbstractAWSConfig=global_aws_config()) = location("PUT", "/geofencing/v0/collections/$(CollectionName)/geofences/$(GeofenceId)", Dict{String, Any}("Geometry"=>Geometry); aws_config=aws_config)
put_geofence(CollectionName, GeofenceId, Geometry, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("PUT", "/geofencing/v0/collections/$(CollectionName)/geofences/$(GeofenceId)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Geometry"=>Geometry), params)); aws_config=aws_config)

"""
    search_place_index_for_position(index_name, position)
    search_place_index_for_position(index_name, position, params::Dict{String,<:Any})

Reverse geocodes a given coordinate and returns a legible address. Allows you to search for
Places or points of interest near a given position.

# Arguments
- `index_name`: The name of the place index resource you want to use for the search.
- `position`: Specifies a coordinate for the query defined by a longitude, and latitude.
  The first position is the X coordinate, or longitude.   The second position is the Y
  coordinate, or latitude.    For example, position=xLongitude&position=yLatitude .

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"MaxResults"`: An optional paramer. The maximum number of results returned per request.
  Default value: 50
"""
search_place_index_for_position(IndexName, Position; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/indexes/$(IndexName)/search/position", Dict{String, Any}("Position"=>Position); aws_config=aws_config)
search_place_index_for_position(IndexName, Position, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/indexes/$(IndexName)/search/position", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Position"=>Position), params)); aws_config=aws_config)

"""
    search_place_index_for_text(index_name, text)
    search_place_index_for_text(index_name, text, params::Dict{String,<:Any})

Geocodes free-form text, such as an address, name, city, or region to allow you to search
for Places or points of interest.  Includes the option to apply additional parameters to
narrow your list of results.  You can search for places near a given position using
BiasPosition, or filter results within a bounding box using FilterBBox. Providing both
parameters simultaneously returns an error.

# Arguments
- `index_name`: The name of the place index resource you want to use for the search.
- `text`: The address, name, city, or region to be used in the search. In free-form text
  format. For example, 123 Any Street.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"BiasPosition"`: Searches for results closest to the given position. An optional
  parameter defined by longitude, and latitude.   The first bias position is the X
  coordinate, or longitude.   The second bias position is the Y coordinate, or latitude.
  For example, bias=xLongitude&bias=yLatitude.
- `"FilterBBox"`: Filters the results by returning only Places within the provided bounding
  box. An optional parameter. The first 2 bbox parameters describe the lower southwest
  corner:   The first bbox position is the X coordinate or longitude of the lower southwest
  corner.   The second bbox position is the Y coordinate or latitude of the lower southwest
  corner.   For example, bbox=xLongitudeSW&bbox=yLatitudeSW. The next bbox parameters
  describe the upper northeast corner:   The third bbox position is the X coordinate, or
  longitude of the upper northeast corner.   The fourth bbox position is the Y coordinate, or
  longitude of the upper northeast corner.   For example,
  bbox=xLongitudeNE&bbox=yLatitudeNE
- `"FilterCountries"`: Limits the search to the given a list of countries/regions. An
  optional parameter.   Use the ISO 3166 3-digit country code. For example, Australia uses
  three upper-case characters: AUS.
- `"MaxResults"`: An optional parameter. The maximum number of results returned per
  request.  The default: 50
"""
search_place_index_for_text(IndexName, Text; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/indexes/$(IndexName)/search/text", Dict{String, Any}("Text"=>Text); aws_config=aws_config)
search_place_index_for_text(IndexName, Text, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("POST", "/places/v0/indexes/$(IndexName)/search/text", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Text"=>Text), params)); aws_config=aws_config)

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

Assigns one or more tags (key-value pairs) to the specified Amazon Location Service
resource.  <p>Tags can help you organize and categorize your resources. You can also
use them to scope user permissions, by granting a user permission to access or change only
resources with certain tag values.</p> <p>You can use the
<code>TagResource</code> operation with an Amazon Location Service resource
that already has tags. If you specify a new tag key for the resource, this tag is appended
to the tags already associated with the resource. If you specify a tag key that's already
associated with the resource, the new tag value that you specify replaces the previous
value for that tag. </p> <p>You can associate up to 50 tags with a
resource.</p>

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource whose tags you want to
  update.   Format example: arn:aws:geo:region:account-id:resourcetype/ExampleResource
- `tags`: Tags that have been applied to the specified resource. Tags are mapped from the
  tag key to the tag value: \"TagKey\" : \"TagValue\".   Format example: {\"tag1\" :
  \"value1\", \"tag2\" : \"value2\"}

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

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

Removes one or more tags from the specified Amazon Location resource.

# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) of the resource from which you want to
  remove tags.   Format example: arn:aws:geo:region:account-id:resourcetype/ExampleResource
- `tag_keys`: The list of tag keys to remove from the specified resource.

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

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

Updates the specified properties of a given geofence collection.

# Arguments
- `collection_name`: The name of the geofence collection to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: Updates the description for the geofence collection.
- `"PricingPlan"`: Updates the pricing plan for the geofence collection. For more
  information about each pricing plan option restrictions, see Amazon Location Service
  pricing.
- `"PricingPlanDataSource"`: Updates the data provider for the geofence collection.  A
  required value for the following pricing plans: MobileAssetTracking| MobileAssetManagement
  For more information about data providers and pricing plans, see the Amazon Location
  Service product page.  This can only be updated when updating the PricingPlan in the same
  request. Amazon Location Service uses PricingPlanDataSource to calculate billing for your
  geofence collection. Your data won't be shared with the data provider, and will remain in
  your AWS account and Region unless you move it.
"""
update_geofence_collection(CollectionName; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/geofencing/v0/collections/$(CollectionName)"; aws_config=aws_config)
update_geofence_collection(CollectionName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/geofencing/v0/collections/$(CollectionName)", params; aws_config=aws_config)

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

Updates the specified properties of a given map resource.

# Arguments
- `map_name`: The name of the map resource to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: Updates the description for the map resource.
- `"PricingPlan"`: Updates the pricing plan for the map resource. For more information
  about each pricing plan option restrictions, see Amazon Location Service pricing.
"""
update_map(MapName; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/maps/v0/maps/$(MapName)"; aws_config=aws_config)
update_map(MapName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/maps/v0/maps/$(MapName)", params; aws_config=aws_config)

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

Updates the specified properties of a given place index resource.

# Arguments
- `index_name`: The name of the place index resource to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"DataSourceConfiguration"`: Updates the data storage option for the place index resource.
- `"Description"`: Updates the description for the place index resource.
- `"PricingPlan"`: Updates the pricing plan for the place index resource. For more
  information about each pricing plan option restrictions, see Amazon Location Service
  pricing.
"""
update_place_index(IndexName; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/places/v0/indexes/$(IndexName)"; aws_config=aws_config)
update_place_index(IndexName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/places/v0/indexes/$(IndexName)", params; aws_config=aws_config)

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

Updates the specified properties for a given route calculator resource.

# Arguments
- `calculator_name`: The name of the route calculator resource to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: Updates the description for the route calculator resource.
- `"PricingPlan"`: Updates the pricing plan for the route calculator resource. For more
  information about each pricing plan option restrictions, see Amazon Location Service
  pricing.
"""
update_route_calculator(CalculatorName; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/routes/v0/calculators/$(CalculatorName)"; aws_config=aws_config)
update_route_calculator(CalculatorName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/routes/v0/calculators/$(CalculatorName)", params; aws_config=aws_config)

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

Updates the specified properties of a given tracker resource.

# Arguments
- `tracker_name`: The name of the tracker resource to update.

# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"Description"`: Updates the description for the tracker resource.
- `"PricingPlan"`: Updates the pricing plan for the tracker resource. For more information
  about each pricing plan option restrictions, see Amazon Location Service pricing.
- `"PricingPlanDataSource"`: Updates the data provider for the tracker resource.  A
  required value for the following pricing plans: MobileAssetTracking| MobileAssetManagement
  For more information about data providers and pricing plans, see the Amazon Location
  Service product page  This can only be updated when updating the PricingPlan in the same
  request. Amazon Location Service uses PricingPlanDataSource to calculate billing for your
  tracker resource. Your data won't be shared with the data provider, and will remain in your
  AWS account and Region unless you move it.
"""
update_tracker(TrackerName; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/tracking/v0/trackers/$(TrackerName)"; aws_config=aws_config)
update_tracker(TrackerName, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()) = location("PATCH", "/tracking/v0/trackers/$(TrackerName)", params; aws_config=aws_config)


text: Dict{String,Any}("~!@\$^&*()_+-`1234567890[]|/?><.,;:'" => Dict{String,Any}("value" => "1","type" => "integer"))

ext: jl

max_stars_repo_name: vanillajonathan/julia

max_issues_repo_name: vanillajonathan/julia

max_forks_repo_name: vanillajonathan/julia


text:
# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.3'
#       jupytext_version: 1.0.4
#   kernelspec:
#     display_name: Julia 1.0.3
#     language: julia
#     name: julia-1.0
# ---

using Weave

const EXAMPLES_DIR = abspath(joinpath(@__DIR__,"..", "examples"))

const JMD_DIR = abspath(joinpath(@__DIR__,"src","examples","jmd"))

const HTML_DIR = abspath(joinpath(@__DIR__,"src","examples","html"))

# +
if isdir(JMD_DIR)
    nothing
else
    mkpath(JMD_DIR)
end

if isdir(HTML_DIR)
    nothing
else
    mkpath(HTML_DIR)
end
# -

# run(`find $EXAMPLES_DIR -maxdepth 1 -name "*.jl" -exec jupytext "{}" --to ipynb ";" `)

function listnotebooks()
    [ i for i in readdir(EXAMPLES_DIR) if splitext(i)[end] == ".ipynb"]
end
nbs = listnotebooks()

function createhtml(nbs)
    for nb in nbs
        @info "Converting $nb to .html file"
        try
        run(`jupyter nbconvert --ExecutePreprocessor.timeout=None --ExecutePreprocessor.kernel_name=julia-1.0
                    --to html --execute $EXAMPLES_DIR/$nb --output $HTML_DIR/$(splitext(nb)[1]).html`)
        catch
        @warn "failed to convert $nb"
        end
    end
end

createhtml(nbs)


text:
# Convert ReactionSource into ODESource
function OdeSource(model::dt.ReactionSource)
  # We will store the modifications in new_model
  new_model = deepcopy(model)

  # Generate the list of states that can be derived from species
  # If there are components, then there is one state from species and a variable
  # With the sum of all the species.
  new_states, new_variables, new_species, all_comp_forms = species_to_states(new_model)
  merge!(new_model.States, new_states)
  merge!(new_model.Variables, new_variables)
  merge!(new_model.Species, new_species)

  # Convert reactions into variables, expanding by components if necessary
  # This will generate the intermediate variables as well as the time derivatives
  new_variables, new_derivatives = reactions_to_variables(new_model, new_states, new_variables, all_comp_forms)
  merge!(new_model.Variables, new_variables)
  merge!(new_model.Derivatives, new_derivatives)

  # Go through all derivatives and expand any pattern expression into a sum of states
  for (key,val) in new_model.Derivatives
    val.Expr = expand_components(val.Expr, all_comp_forms)
  end

  # Go through all variables and expand any pattern expression
  for (key,val) in new_model.Variables
    val.Expr = expand_components(val.Expr, all_comp_forms)
  end

  # Go through all observed and expand any pattern expression
  for (key,val) in new_model.Observed
    val.Expr = expand_components(val.Expr, all_comp_forms)
  end

  return dt.OdeSource(new_model.DynamicType, new_model.Constants,
                      new_model.Parameters, new_model.Forcings,
                      new_model.States, new_model.Derivatives,
                      new_model.Variables, new_model.Observed)
end

function expand_components(expression::ASCIIString, all_comp_forms)
    if !contains(expression, "{")
      return expression
    else
      # ID the species being matched by patterns
      species = matchall(r"[a-zA-Z0-9_]+(?=\{)", expression)
      contents = matchall(r"(?<=\{)[a-zA-Z0-9_\[\]]+(?=\})", expression)
      for k in 1:length(species)
        # Extract the component forms for a particular species
        allcompforms = all_comp_forms[species[k]]
        # Extract the elements of the patterns
        compforms = extract_pattern("$(species[k]){$(contents[k])}")
        # Iterate over all columns and keep track of matched rows
        h = [1:size(allcompforms, 1)]
        for i in compforms
          for j in 1:size(allcompforms, 2)
            if i in allcompforms[:,j]
              # Reduce h to those rows that match
              h = intersect(h, findin(allcompforms[:,j], [i]))
              break
            else
              continue
            end
          end
        end
        final_forms = allcompforms[h,:]
        expanded = "($(species[k])_" * paste("", vec(final_forms[1,:]))
        for i in 2:size(final_forms, 1)
          expanded *= " + $(species[k])_" * paste("", vec(final_forms[i,:]))
        end
        expanded *= ")"
        expression = replace(expression, "$(species[k]){$(contents[k])}", expanded)
      end
      return expression
    end
end

function species_to_states(new_model::dt.ReactionSource)
  new_states = OrderedDict{ASCIIString, dt.State}()
  new_species = OrderedDict{ASCIIString, dt.Species}()
  new_variables = OrderedDict{ASCIIString, dt.Variable}()
  all_mat_comp_forms = OrderedDict{ASCIIString, Array{ASCIIString,2}}()
  # Iterate over species
  for (key,val) in new_model.Species
    if length(val.Components) == 0
      new_states[key] = dt.State(val.Value, val.Units, val.QSS)
    # If the chemical species contains components, calculate all possible forms and generate the names
    else
      # Total amount of the species
      total_amount = val.Value
      # Total number of states that will be generated
      number = prod([length(i.Forms) for i in val.Components])
      # Jagged array of component-forms
      components_forms = [ ASCIIString[i.Name*j for j in i.Forms ] for i in val.Components]
      # Jagged array of component-values
      components_values = [ i.Values for i in val.Components]
      # Matrix with all the component_forms
      # Generate all possible combinations using repeat and the correct inner/outer combinations
      mat_comp_forms = Array(ASCIIString, number, length(components_forms))
      small = components_forms[1]
      mat_comp_forms[:,1] = repeat(small, outer = [integer(number/length(small))])
      for i in 2: length(components_forms)
        try
          small = repeat(components_forms[i], inner = [length(small)])
          mat_comp_forms[:,i] = repeat(small, outer = [integer(number/length(small))])
        catch
          println("Error in generating component-forms matrix: species was $key.")
          println("Component_forms were $components_forms")
          println("New assignment was $(repeat(small, outer = [integer(number/length(small))]))")
        end
      end
      # Matrix with all the component_values
      # Generate all possible combinations using repeat and the correct inner/outer combinations
      mat_comp_values = Array(Float64, number, length(components_values))
      small = components_values[1]
      mat_comp_values[:,1] = repeat(small, outer = [integer(number/length(small))])
      for i in 2: length(components_values)
        try
          small = repeat(components_values[i], inner = [length(small)])
          mat_comp_values[:,i] = repeat(small, outer = [integer(number/length(small))])
        catch
          println("Error in generating component-values matrix: species was $key.")
          println("Component_values were $components_values")
          println("New assignment was $(repeat(small, outer = [integer(number/length(small))]))")
        end
      end
      # Reduce the forms and numbers to vectors. Concatenate without intermediate symbol
      forms = Array(ASCIIString, number)
      values = Array(Float64, number)
      for i in 1:number
        forms[i] = key * "_" * prod(mat_comp_forms[i,:])
        values[i] = prod(mat_comp_values[i,:])
        new_states[forms[i]] = dt.State(values[i]*total_amount, val.Units, val.QSS)
        new_species[forms[i]] = dt.Species(values[i]*total_amount, val.Compartment, val.Units, {}, val.QSS)
      end
      # Create a variable with the name of the species that is equal to the sum of all components
      new_variables[key] = dt.Variable(paste(" + ", forms)[1:(end-2)] , val.Units)
      all_mat_comp_forms[key] = mat_comp_forms
    end
  end
  # Return the new_states and new_variables, as well as intermediate calculations that may be useful later on
  return new_states, new_variables, new_species, all_mat_comp_forms

end

function reactions_to_variables(new_model::dt.ReactionSource,
                                new_states::OrderedDict{ASCIIString,dt.State},
                                new_variables::OrderedDict{ASCIIString,dt.Variable},
                                all_mat_comp_forms::OrderedDict{ASCIIString, Array{ASCIIString,2}})
  # Create empty Derivative objects for each element in new_states
  # Use d_state_dt syntax to generate the new derivatives
  new_derivatives = OrderedDict{ASCIIString, dt.Derivative}()
  for (key,val) in new_states
    if "d_$(key)_dt" in collect(keys(new_model.Derivatives))
      new_derivatives["d_$(key)_dt"] = new_model.Derivatives["d_$(key)_dt"]
    else
      new_derivatives["d_$(key)_dt"] = dt.Derivative("", key, val.Units)
    end
  end

  # Iterate over all reactions and populate associated new_variables and new_derivatives
  # It depends very much on whether we are using patterns in the stoichiometry or not
  for (key,val) in new_model.Reactions

    # In the case that we have patterns in the reaction stoichiometry
    if reaction_contains_components(new_model, val)
      # Id chemical species on either side of the reaction that contain components
      substrate_pattern, substrate_pattern_species::ASCIIString = who_has_components(new_model, val.Substrates)
      product_pattern, product_pattern_species::ASCIIString = who_has_components(new_model, val.Products)
      # Only allow reactions where there is one chemical species per side of reaction and they are the same chemical species
      (!isa(substrate_pattern_species, ASCIIString) || !isa(product_pattern_species, ASCIIString)) && error("Error in reaction $key: I cannot process this reaction. Too many chemical species with components.")
      substrate_pattern_species != product_pattern_species && error("Error in reaction $key: The species with components on either side of the reaction must be the same.")
      # Create matrix of substrate/product pairs from substrates and products that have patterns
      states_reactants_forms = states_from_master_equation(substrate_pattern, product_pattern, substrate_pattern_species, all_mat_comp_forms)
      # Every row will generate a new reaction
      # Any mention of a pattern in the expression is substited by the expanded state
      new_reactions = OrderedDict{ASCIIString, dt.Reaction}()
      for i in 1:size(states_reactants_forms, 1)
        expanded_form = vec(states_reactants_forms[i,:])
        # Replace references to the substrate in the mathematical expression
        expanded_expression = replace(val.Expr, substrate_pattern.Name, expanded_form[1] )
        expanded_expression = replace(expanded_expression, product_pattern.Name, expanded_form[2] )
        # Create the substrates and products for the new reaction
        substrates = dt.Reactant[dt.Reactant(expanded_form[1], substrate_pattern.Stoichiometry)]
        for i in val.Substrates
          (i == substrate_pattern) && continue
          push!(substrates, i)
        end
        products = dt.Reactant[dt.Reactant(expanded_form[2], product_pattern.Stoichiometry)]
        for i in val.Products
          (i == product_pattern) && continue
          push!(products, i)
        end
        new_reactions["v_$(expanded_form[1])_$(expanded_form[2])"] = dt.Reaction(substrates, products, expanded_expression, val.Compartment, val.Units)
      end
      # Iterate over new reactions and execute the code for no-pattern reactions
      # to generate the new reactions from extending the components
      # Need to add a Variable that captures the sum of all this individual reactions
      # so that we can still make a reference to the original reaction with components
      sum_all = ""
      for (key2,val2) in new_reactions
        process_reaction_no_pattern!(new_model, val2, key2, new_variables, new_derivatives)
        sum_all *= "($(val2.Expr))+"
      end
      sum_all = sum_all[1:(end-1)]
      new_variables[key] = dt.Variable(sum_all, val.Units)
    # In the case that we don't have patterns in the reaction stoichiometry
    else
      process_reaction_no_pattern!(new_model, val, key, new_variables, new_derivatives)
    end
  end

  return new_variables, new_derivatives
end

# Check if a reaction stoichiometry contains species with components, regardless
# of whether there are patterns or not
function reaction_contains_components(model::dt.ReactionSource, reaction::dt.Reaction)
  # Do substrates contain a chemical species with components?
  for i in reaction.Substrates
    (contains(i.Name, "{") || length(model.Species[i.Name].Components) > 0) && return true
  end
  # Do products contain a chemical species with components?
  for i in reaction.Products
    (contains(i.Name, "{") || length(model.Species[i.Name].Components) > 0) && return true
  end
  return false
end

# Return the species that contains components in a set of reactants or products,
# regardless of whether there are patterns or not
function who_has_components(new_model::dt.ReactionSource, reactants::Vector{dt.Reactant})
  for i in reactants
    if contains(i.Name, "{") || (length(model.Species[i.Name].Components) > 0)
      species = match(r"[a-zA-Z0-9_]*(?=\{)", i.Name).match
      return i, species
    end
  end
end

# Calculate a 2-column matrix where each row is a substrate/product combination
function states_from_master_equation(substrate::dt.Reactant, product::dt.Reactant, species::ASCIIString,
                                     comp_forms::OrderedDict{ASCIIString, Array{ASCIIString,2}})
  # Extract the matrices for the substrates and products containing all the combinations of component forms
  substrate_components = deepcopy(comp_forms[species])
  product_components = deepcopy(comp_forms[species])
  # Extract patterns from substrate/products -> Array with the individual component-form
  substrate_patterns = extract_pattern(substrate.Name)
  product_patterns = extract_pattern(product.Name)
  # Select rows that meet the pattern (the components targeted by the different patterns should be the same)
  target_columns_s, substrate_components = subset_with_patterns(substrate_components, substrate_patterns)
  target_columns_p, product_components = subset_with_patterns(product_components, product_patterns)
  sort(target_columns_s) != sort(target_columns_p) &&
            error("Error in states_from_master_equation. The patterns on either side don't target the same components")
  # Which columns are not targeted by patterns?
  non_target_columns = filter(x -> !in(x, target_columns_s),  1:size(substrate_components, 2))
  # Every row in substrate_components is combined with each row in product_components where
  # the non-target columns have the same elements as the corresponding non-target columns in the substrate_components
  products = [product_from_substrate(substrate_components[i,:], non_target_columns, product_components) for i in 1:size(substrate_components, 1)]
  # Generate a matrix where the first column is the string representing the state for the substrate
  # and the second column is the string of the product
  substrate_product = ASCIIString[""  ""]
  for i in 1:length(products)
    sub_name = species * "_" * paste("", vec(substrate_components[i,:]))
    prod_name = ASCIIString[species * "_" * paste("", vec(products[i][j,:])) for j in 1:size(products[i], 1)]
    tmp = reshape(repeat([sub_name],outer = [length(prod_name)]),length(prod_name), 1)
    tmp = hcat(tmp, prod_name)
    substrate_product = vcat(substrate_product, tmp)
  end
  return substrate_product[2:end,:]
end

# Extract rows of component-form matrix in the product where non-target columns
# coincide with the non-target columns of the substrate
function product_from_substrate(substrate, non_target_columns, product_components)
  size(product_components, 1) == 1 && (return product_components)
  # Extract non-target columns of both substrates and products
  non_target_substrate = substrate[:,non_target_columns]
  non_target_product   = product_components[:,non_target_columns]
  # Intersection between substrate and product non-target component-forms
  matches = Int64[]
  for i in 1:size(non_target_product, 1)
    sort(vec(non_target_product[i,:])) == sort(vec(non_target_substrate)) && (push!(matches, i))
  end
  return product_components[matches,:]

end

# Given a pattern, extract the components in it
function extract_pattern(pat::ASCIIString)
  compforms = match(r"(?<=\{)[a-zA-Z0-9_\[\]]*(?=\})", pat).match
  forms = matchall(r"(?<=\[)[a-zA-Z0-9_]+(?=\])", compforms)
  components = matchall(r"[a-zA-Z0-9_]+(?=\[)", compforms)
  ASCIIString[components[i]*forms[i] for i in 1:length(forms)]
end

# Given a matrix with all possible combinations of component forms
# and a series of component forms, extract the subset of the matrix
function subset_with_patterns(substrate_components, substrate_patterns)
  target_columns = Int64[]
  # Iterate over all patterns
  for i in substrate_patterns
    # Find the column that contains the component
    col = 0
    for j in 1:size(substrate_components, 2)
      if i in substrate_components[:,j]
        # Store the column where the pattern is found and subset the matrix of component-forms
        # by the row where the match happened
        push!(target_columns, j)
        substrate_components = substrate_components[findin(substrate_components[:,j], [i]),:]
        break
      else
        continue
      end
    end
  end
  return target_columns, substrate_components
end

function process_reaction_no_pattern!(new_model::dt.ReactionSource, reaction::dt.Reaction, key::ASCIIString, new_variables, new_derivatives)
  new_variables[key] = dt.Variable(reaction.Expr, reaction.Units)
  for i in reaction.Substrates
    # Capture current expression for the associated time derivative
    previous_expr = new_derivatives["d_$(i.Name)_dt"].Expr
    # Extract the compartments of the reaction and the species that participates in the reaction
    compartment_reaction = reaction.Compartment
    compartment_reactant = new_model.Species[i.Name].Compartment
    # If the compartments are the same, don't generate conversion. If they are not, generate the conversion
    compartment_reaction != compartment_reactant ?
                            (ratio_comp = "*$compartment_reaction/$compartment_reactant") :
                            (ratio_comp = "")
    haskey(new_model.Parameters, compartment_reaction) ?
          compartment_reaction_units = new_model.Parameters[compartment_reaction].Units :
          compartment_reaction_units = new_model.States[compartment_reaction].Units
    haskey(new_model.Parameters, compartment_reactant) ?
          compartment_reactant_units = new_model.Parameters[compartment_reactant].Units :
          compartment_reactant_units = new_model.States[compartment_reactant].Units
    ratio_comp_units = compartment_reaction_units/compartment_reactant_units
    # The new expression where the rate equation is substracted from the time derivative (important to use ()!!)
    new_expr = previous_expr * "- $(i.Stoichiometry)($key)$ratio_comp"
    new_derivatives["d_$(i.Name)_dt"] = dt.Derivative(new_expr, i.Name, reaction.Units*ratio_comp_units)
  end
  for i in reaction.Products
    # Capture current expression for the associated time derivative
    previous_expr = new_derivatives["d_$(i.Name)_dt"].Expr
    # Extract the compartments of the reaction and the species that participates in the reaction
    compartment_reaction = reaction.Compartment
    compartment_reactant = new_model.Species[i.Name].Compartment
    # If the compartments are the same, don't generate conversion. If they are not, generate the conversion
    compartment_reaction != compartment_reactant ?
                            (ratio_comp = "*$compartment_reaction/$compartment_reactant") :
                            (ratio_comp = "")
    haskey(new_model.Parameters, compartment_reaction) ?
          compartment_reaction_units = new_model.Parameters[compartment_reaction].Units :
          compartment_reaction_units = new_model.States[compartment_reaction].Units
    haskey(new_model.Parameters, compartment_reactant) ?
          compartment_reactant_units = new_model.Parameters[compartment_reactant].Units :
          compartment_reactant_units = new_model.States[compartment_reactant].Units
    ratio_comp_units = compartment_reaction_units/compartment_reactant_units
    # The new expression where the rate equation is substracted from the time derivative (important to use ()!!)
    new_expr = previous_expr * "+ $(i.Stoichiometry)($key)$ratio_comp"
    new_derivatives["d_$(i.Name)_dt"] = dt.Derivative(new_expr, i.Name, reaction.Units*ratio_comp_units)
  end

end


text:
using DashBootstrapComponents

tabs = html_div([
    dbc_tabs([
        dbc_tab(label = "tab 1", active_tab_style = Dict("textTransform" => "uppercase")),
        dbc_tab(label = "tab 2", active_label_style = Dict("color" => "#FB79B3")),
    ]),
    html_br(),
    dbc_tabs([
        dbc_tab(label = "Tab 1", activeTabClassName = "fw-bold fst-italic"),
        dbc_tab(label = "Tab 2", activeLabelClassName = "text-success"),
    ]),
]);

max_issues_repo_name: sthagen/dash-bootstrap-components

max_forks_repo_name: sthagen/dash-bootstrap-components


text:
using ControlSystems
using MAT

@testset "simulateMS" begin
    # MATLAB output
    test = matread("resources/simulateMS.mat")

    # input parameters
    M = 16
    N = 16384
    f = 164
    A0 = undbv(-3)
    A1 = undbv(-30)
    ntf = synthesizeNTF(6, 25, 1, 4)
    mtf1 = zpk([1], [0], 1, 1)
    mtf2 = zpk([1, 1], [0.3, 0.3], 1, 1)
    mtf3 = synthesizeNTF(2, 25, 1, 2)
    mtf4 = synthesizeNTF(4, 22.5, 1, 1.3)
    A   = [  A0,   A0,  A1,    A0,   A0]
    mtf = [mtf1, mtf2, mtf1, mtf3, mtf4]

    for i = 1:length(mtf)
        u = M * A[i] * sin.(2*pi*f/N * (0:N-1))
        v, = simulateDSM(u, ntf, M+1)
        sv, sx, sigma_se, max_sx, max_sy = simulateMS(v, M, mtf[i])
        @test test["sv_$i"] == sv
        @test isapprox(test["sx_$i"], sx)
        @test isapprox(test["sigma_se_$i"], sigma_se)
        @test isapprox(test["max_sx_$i"], max_sx)
        @test isapprox(test["max_sy_$i"], max_sy)
    end

    # test with dw != [1, 1, ... , 1]
    dw = [8; 8; 4; 4; 2; 2; 1; 1; zeros(Int, 8)]
    u = M * A0 * sin.(2*pi*f/N * (0:N-1))
    v, = simulateDSM(u, ntf, M+1)
    sv, sx, sigma_se, max_sx, max_sy = simulateMS(v, M, mtf4, 0 , dw)
    @test test["sv_dw"] == sv
    @test isapprox(test["sx_dw"], sx)
    @test isapprox(test["sigma_se_dw"], sigma_se)
    @test isapprox(test["max_sx_dw"], max_sx)
    @test isapprox(test["max_sy_dw"], max_sy)
end

max_stars_repo_name: Mahmoud-Kharsa/DeltaSigma

max_issues_repo_name: Mahmoud-Kharsa/DeltaSigma

max_forks_repo_name: Mahmoud-Kharsa/DeltaSigma


text:
function icn_all_equal(x; X = zeros(length(x), 3), param=nothing, dom_size)
    CompositionalNetworks.tr_in(Tuple([CompositionalNetworks.tr_contiguous_vals_minus, CompositionalNetworks.tr_count_l_left, CompositionalNetworks.tr_count_greater]), X, x, param)
    for i in 1:length(x)
        X[i,1] = CompositionalNetworks.ar_sum(@view X[i,:])
    end
    return CompositionalNetworks.ag_count_positive(@view X[:, 1]) |> (y -> CompositionalNetworks.co_euclidian(y; param, dom_size, nvars=length(x)))
end


text:
# From Sun and Stein 2016 JCGS, which is to my knowledge the first explicit
# method for computing precision matrices induced by Vecchia likelihoods.
#
# TODO (cg 2021/11/19 10:15): It would lead to even less readable code, but it
# would probably further help threading performance to squeeze out _all_
# allocations from the parallel loop, which means pre_allocating for _sI, _sJ,
# and _sV. Could potentially pre-allocate large enough buffers once, like with
# workcc/workpp/workcp, but I'm not sure how that will interact with append!!.
function precisionmatrix(V::VecchiaConfig{D,F}, params::Vector{T}) where{D,F,T}
  # Check that the conditioning set indices are sorted:
  checksorted(V)
  # Create master indices for sparse matrix stuff.
  gixs = globalidxs(V.data)
  # create thread buffers for the matrices like in the nll function.
  n    = sum(length, V.pts)
  chsz = V.chunksize        # this probably should be computed more carefully.
  ccsz = chsz*V.blockrank   # this probably should be computed more carefully.
  cpsz = chsz + ccsz
  # Construct the small piece of the sparse matrix for each chunk.
  @floop ThreadedEx() for j in 1:length(V.condix)
    @init workcc = Array{T}(undef, cpsz, cpsz)
    @init workcp = Array{T}(undef, ccsz, chsz)
    @init workpp = Array{T}(undef, chsz, chsz)
    # Extract the relevant indices and the actual points. We delay preparing the
    # set of conditioning points in case it's empty.
    (idxs, pts) = (V.condix[j], V.pts[j])
    # Prepare the buffer for points[j], doing this first so that we can early
    # return for the edge case of j==1 and so cpts is empty.
    pbuf = view(workpp, 1:length(pts),  1:length(pts))
    updatebuf!(pbuf, pts, pts, V.kernel, params)
    if isone(j)
      (_sI, _sJ, _sV) = sunsteinchunk1(T, n, pbuf)
    else
      # now that we know the set of conditioning points isn't empty, prepare it.
      cpts   = reduce(vcat, V.pts[idxs])
      # prepare the other buffers and update them.
      cbuf   = view(workcc, 1:length(cpts), 1:length(cpts))
      cpbuf  = view(workcp, 1:length(cpts), 1:length(pts))
      updatebuf!(cbuf,  cpts, cpts, V.kernel, params)
      updatebuf!(cpbuf, cpts,  pts, V.kernel, params)
      # compute the solve that gets used for b.
      fcbuf  = cholesky!(cbuf)
      solve  = fcbuf\cpbuf
      # compute the conditional covariance matrix and factorize it.
      mul!(pbuf, Adjoint(cpbuf), solve, -1, 1)
      fccov  = cholesky!(Symmetric(pbuf))
      # compute the additional nonzero indices and values for the sparse matrix.
      mulbuf = view(workcc, 1:(length(pts) + length(cpts)),
                            1:(length(pts) + length(cpts)))
      (_sI, _sJ, _sV) = sunsteinchunk(T, n, solve, fccov, mulbuf,
                                      gixs[j], reduce(vcat, gixs[idxs]))
    end
    # append (in a thread safe way) to the master (I,J,V) vectors.
    @reduce(sI = append!!(EmptyVector{Int64}(), _sI))
    @reduce(sJ = append!!(EmptyVector{Int64}(), _sJ))
    @reduce(sV = append!!(EmptyVector{T}(),     _sV))
  end
  Symmetric(sparse(sI, sJ, sV), :L)
end

function nll_precision(S, data)
  Sf = cholesky(S)
  0.5*(-logdet(Sf) + dot(data, S, data))
end


text:
C2vs = [Symmetry.Symel("E", [1 0 0; 0 1 0; 0 0 1]),
    Symmetry.Symel("C_2^1", [-1.0 -1.2246467991473532e-16 0.0; 1.2246467991473532e-16 -1.0 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_1", [-1.0 4.898587196589413e-16 -0.0; 4.898587196589413e-16 1.0 0.0; -0.0 0.0 1.0]),
    Symmetry.Symel("sigmad_1", [1.0 -3.6739403974420594e-16 0.0; -3.6739403974420594e-16 -1.0 0.0; 0.0 0.0 1.0])]

C3vs = [Symmetry.Symel("E", [1 0 0; 0 1 0; 0 0 1]),
    Symmetry.Symel("C_3^1", [-0.4999999999999998 -0.8660254037844387 0.0; 0.8660254037844387 -0.4999999999999998 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_3^2", [-0.5000000000000003 0.8660254037844384 0.0; -0.8660254037844384 -0.5000000000000003 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_2", [0.5000000000000002 0.8660254037844387 0.0; 0.8660254037844387 -0.5000000000000009 -0.0; 0.0 -0.0 1.0]),
    Symmetry.Symel("sigmav_3", [0.4999999999999991 -0.8660254037844394 0.0; -0.8660254037844394 -0.4999999999999998 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_1", [-1.0 1.2212453270876724e-15 -0.0; 1.2212453270876724e-15 1.0 0.0; -0.0 0.0 1.0])]

C4vs = [Symmetry.Symel("E", [1 0 0; 0 1 0; 0 0 1]),
    Symmetry.Symel("C_4^1", [6.123233995736766e-17 -1.0 0.0; 1.0 6.123233995736766e-17 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_2^1", [-1.0 -1.2246467991473532e-16 0.0; 1.2246467991473532e-16 -1.0 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_4^3", [-1.8369701987210297e-16 1.0 0.0; -1.0 -1.8369701987210297e-16 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_2", [-1.0 2.4492935982947064e-16 0.0; 2.4492935982947064e-16 1.0 -0.0; 0.0 -0.0 1.0]),
    Symmetry.Symel("sigmav_1", [-1.0 4.898587196589413e-16 -0.0; 4.898587196589413e-16 1.0 0.0; -0.0 0.0 1.0]),
    Symmetry.Symel("sigmad_2", [2.220446049250313e-16 1.0 0.0; 1.0 -2.220446049250313e-16 -0.0; 0.0 -0.0 1.0]),
    Symmetry.Symel("sigmad_1", [-4.440892098500626e-16 -1.0 0.0; -1.0 4.440892098500626e-16 0.0; 0.0 0.0 1.0])]

C5vs = [Symmetry.Symel("E", [1 0 0; 0 1 0; 0 0 1]),
    Symmetry.Symel("C_5^1", [0.30901699437494745 -0.9510565162951535 0.0; 0.9510565162951535 0.30901699437494745 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_5^2", [-0.8090169943749473 -0.5877852522924731 0.0; 0.5877852522924731 -0.8090169943749473 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_5^3", [-0.8090169943749475 0.587785252292473 0.0; -0.587785252292473 -0.8090169943749475 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_5^4", [0.30901699437494734 0.9510565162951535 0.0; -0.9510565162951535 0.30901699437494734 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_2", [0.8090169943749473 -0.5877852522924734 -0.0; -0.5877852522924734 -0.8090169943749481 -0.0; -0.0 -0.0 1.0]),
    Symmetry.Symel("sigmav_3", [-0.3090169943749479 0.951056516295154 0.0; 0.951056516295154 0.3090169943749471 -0.0; 0.0 -0.0 1.0]),
    Symmetry.Symel("sigmav_4", [-0.30901699437494834 -0.9510565162951539 0.0; -0.9510565162951539 0.30901699437494745 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_5", [0.8090169943749475 0.5877852522924731 -0.0; 0.5877852522924731 -0.8090169943749481 0.0; -0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_1", [-1.0 2.2204460492503136e-16 -0.0; 2.2204460492503136e-16 1.0 0.0; -0.0 0.0 1.0])]

C6vs = [Symmetry.Symel("E", [1 0 0; 0 1 0; 0 0 1]),
    Symmetry.Symel("C_6^1", [0.5000000000000001 -0.8660254037844386 0.0; 0.8660254037844386 0.5000000000000001 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_3^1", [-0.4999999999999998 -0.8660254037844388 0.0; 0.8660254037844388 -0.4999999999999998 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_2^1", [-1.0 -3.885780586188048e-16 0.0; 3.885780586188048e-16 -1.0 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_3^2", [-0.5000000000000006 0.8660254037844385 0.0; -0.8660254037844385 -0.5000000000000006 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("C_6^5", [0.49999999999999944 0.8660254037844392 0.0; -0.8660254037844392 0.49999999999999944 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_2", [0.5000000000000002 0.8660254037844387 0.0; 0.8660254037844387 -0.5000000000000009 -0.0; 0.0 -0.0 1.0]),
    Symmetry.Symel("sigmav_3", [0.4999999999999991 -0.8660254037844394 0.0; -0.8660254037844394 -0.4999999999999998 0.0; 0.0 0.0 1.0]),
    Symmetry.Symel("sigmav_1", [-1.0 1.2212453270876724e-15 -0.0; 1.2212453270876724e-15 1.0 0.0; -0.0 0.0 1.0]),
    Symmetry.Symel("sigmad_2", [1.0 -4.440892098500626e-16 -0.0; -4.440892098500626e-16 -1.0 -0.0; -0.0 -0.0 1.0]),
    Symmetry.Symel("sigmad_3", [-0.4999999999999998 0.8660254037844392 0.0; 0.8660254037844392 0.49999999999999933 -0.0; 0.0 -0.0 1.0]),
    Symmetry.Symel("sigmad_1", [-0.5000000000000009 -0.8660254037844383 0.0; -0.8660254037844383 0.5000000000000008 0.0; 0.0 0.0 1.0])]

C2vcn = ["A1", "A2", "B1", "B2"]
C2vct = [1.0 1.0 1.0 1.0; 1.0 1.0 -1.0 -1.0; 1.0 -1.0 1.0 -1.0; 1.0 -1.0 -1.0 1.0]
C3vcn = ["A1", "A2", "E"]
C3vct = [1.0 1.0 1.0; 1.0 1.0 -1.0; 2.0 -1.0 0.0]
C4vcn = ["A1", "A2", "B1", "B2", "E"]
C4vct = [1.0  1.0  1.0  1.0  1.0; 1.0 1.0 1.0 -1.0 -1.0; 1.0 -1.0 1.0 1.0 -1.0; 1.0 -1.0 1.0 -1.0 1.0; 2.0 0.0 -2.0 0.0 0.0]
C5vcn = ["A1", "A2", "E1", "E2"]
C5vct = [1.0 1.0 1.0 1.0;
         1.0 1.0 1.0 -1.0;
         2.0 twocos72 twocos144 0.0;
         2.0 twocos144 twocos72 0.0]
C6vcn = ["A1", "A2", "B1", "B2", "E1", "E2"]
C6vct = [1.0  1.0  1.0  1.0  1.0  1.0;
         1.0  1.0  1.0  1.0 -1.0 -1.0;
         1.0 -1.0  1.0 -1.0  1.0 -1.0;
         1.0 -1.0  1.0 -1.0 -1.0  1.0;
         2.0  1.0 -1.0 -2.0  0.0  0.0;
         2.0 -1.0 -1.0  2.0  0.0  0.0]


text:
H = Hilbert(10)
@test full(H)[10,10] == 1//(10+10-1)


text:
@testset "Low-level API" begin
    env = CPLEX.Env()
    CPLEX.set_logfile(env, "cplex.log")
    CPLEX.close_CPLEX(env)
end


text:
if VERSION < v"1.2"
    require_one_based_indexing(A...) = !Base.has_offset_axes(A...) || throw(ArgumentError("offset arrays are not supported but got an array with index other than 1"))
else
    const require_one_based_indexing = Base.require_one_based_indexing
end

if VERSION < v"1.1"
    isnothing(x) = x === nothing
end