###############################################################################
# Copyright 2019 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################

apiVersion: v1
kind: ConfigMap
metadata:
  name: kappnav.actions.liberty-sa-app
data:
  url-actions: |
    [
      { 
        "name":"home",
        "text":"View home page",
        "description":"View home page",
        "url-pattern":"http://${resource.$.metadata.annotations.host}:${resource.$.metadata.annotations.port}",
        "open-window": "tab",
        "menu-item": "true"
      },
      { 
        "name":"consolelog",
        "text":"View console log",
        "description":"View console log",
        "url-pattern":"http://${resource.$.metadata.annotations.host}:${resource.$.metadata.annotations.port}/liberty-sample/logging?name=console",
        "open-window": "tab",
        "menu-item": "true"
      },
      { 
        "name":"messageslog",
        "text":"View message log",
        "description":"View message log",
        "url-pattern":"http://${resource.$.metadata.annotations.host}:${resource.$.metadata.annotations.port}/liberty-sample/logging?name=messages",
        "open-window": "tab",
        "menu-item": "true"
      }
    ]
  cmd-actions: |
    [
      {
        "name": "startserver",
        "text": "Start server",
        "description": "Start server",
        "image": "mrglavas/liberty-command-actions:latest",
        "cmd-pattern": "sh /scripts/startLiberty.sh ${resource.$.metadata.annotations.host} ${resource.$.metadata.annotations.user} ${resource.$.metadata.annotations.password} ${resource.$.metadata.annotations.libertydir} ${resource.$.metadata.annotations.servername}"
      },
      {
        "name": "stopserver",
        "text": "Stop server",
        "description": "Stop server",
        "image": "mrglavas/liberty-command-actions:latest",
        "cmd-pattern": "sh /scripts/stopLiberty.sh ${resource.$.metadata.annotations.host} ${resource.$.metadata.annotations.user} ${resource.$.metadata.annotations.password} ${resource.$.metadata.annotations.libertydir} ${resource.$.metadata.annotations.servername}"
      }
    ]