Files
murano/contrib/plugins/murano_exampleplugin/example-app/io.murano.apps.demo.DemoApp/Classes/ImageValidatorMixin.yaml
Tetiana Lashchova 7cc34e831b Add io.murano namespace to demo app for example plugin
Change-Id: I0a7fa28f0b56efa74478ea63fe4060c63957493b
Closes-Bug: #1595207
2016-06-22 17:33:52 +03:00

39 lines
1.1 KiB
YAML

Namespaces:
=: io.murano.apps.example.plugin
res: io.murano.resources
std: io.murano
Name: ImageValidatorMixin
Extends:
- res:Instance
Properties:
requiredType:
Contract: $.string().notNull()
Methods:
validateImage:
Body:
- $environment: $.find(std:Environment).require()
- Try:
- $glance: new('io.murano.extensions.mirantis.example.Glance', $environment)
Catch:
With: 'murano.dsl.exceptions.NoPackageForClassFound'
Do:
Throw: PluginNotFoundException
Message: 'Plugin for interaction with Glance is not installed'
- $glanceImage: $glance.getById($.image)
- If: $glanceImage = null
Then:
Throw: ImageNotFoundException
Message: 'Image with specified Id was not found'
- If: $glanceImage.meta = null
Then:
Throw: InvalidImageException
Message: 'Image does not contain Murano metadata tag'
- If: $glanceImage.meta.type != $.requiredType
Then:
Throw: InvalidImageException
Message: 'Image has unappropriate Murano type'