#-----------------------------------------------------------------------------------------------------------------------
#   Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
#  Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
#  with the License. A copy of the License is located at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
#  OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
#  and limitations under the License.
#-----------------------------------------------------------------------------------------------------------------------
## cdf-cdf-core-servicesA overrides

## include mappings
-   command: update
    path: Mappings.SourceCode
    value:
      General:
        S3Bucket: "%%BUCKET_NAME%%"
        KeyPrefix: "%%SOLUTION_NAME%%/%%VERSION%%"
        TemplateBucket: "%%TEMPLATE_BUCKET_NAME%%"

-   command: update
    path: Resources.AssetLibrary.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-assetLibrary-parent.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.Bastion.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-bastion-host.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.Provisioning.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-provisioning.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.Commands.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-commands.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.DeviceMonitoring.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-device-monitoring.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.EventsProcessor.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-eventsProcessor.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.EventsAlerts.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-eventsAlerts.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.AssetLibraryHistory.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-assetLibraryHistory.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.AssetLibraryExport.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-assetlibrary-export.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.BulkCerts.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-bulkcerts.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.CertificateActivator.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-certificateactivator.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.CertificateVendor.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-certificatevendor.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.DevicePatcher.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-device-patcher.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.Greengrass2Provisioning.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-greengrass2-provisioning.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]

-   command: update
    path: Resources.Greengrass2InstallerConfigGenerators.Properties.TemplateURL
    value: !Sub
      - "https://s3.amazonaws.com/${S3Bucket}/${KeyPrefix}/cfn-greengrass2-installer-config-generators.template"
      - S3Bucket: !FindInMap ["SourceCode", "General", "TemplateBucket"]
        KeyPrefix: !FindInMap ["SourceCode", "General", "KeyPrefix"]