# 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.

name: 'Deploy Model - Watson Machine Learning'
description: |
  Deploy stored model on Watson Machine Learning as a web service.
metadata:
  annotations: {platform: 'IBM Watson Machine Learning'}
inputs:
  - {name: model_uid,        description: 'Required. UID for the stored model on Watson Machine Learning'}
  - {name: model_name,       description: 'Required. Model Name on Watson Machine Learning'}
  - {name: scoring_payload,  description: 'Sample Payload file name in the object storage', default: ''}
  - {name: deployment_name,  description: 'Deployment Name on Watson Machine Learning', default: ''}
outputs:
  - {name: scoring_endpoint, description: 'Link to the deployed model web service'}
  - {name: model_uid,        description: 'UID for the stored model on Watson Machine Learning'}
implementation:
  container:
    image: docker.io/aipipeline/wml-deploy:latest
    command: ['python']
    args: [
      -u, /app/wml-deploy.py,
      --model-uid, {inputValue: model_uid},
      --model-name, {inputValue: model_name},
      --scoring-payload, {inputValue: scoring_payload},
      --deployment-name, {inputValue: deployment_name},
      --output-scoring-endpoint-path, {outputPath: scoring_endpoint},
      --output-model-uid-path, {outputPath: model_uid}
    ]
