You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$metaObject = new OutCompute\CloudMetaData\MetaData($cache);
41
-
$metaData = $metaObject->get();
60
+
$metaData = $metaObject->get('json');
61
+
var_export($metaData);
62
+
?>
63
+
```
64
+
65
+
### Templated Responses
66
+
If you've cross cloud deployments and use the metadata in any way, then it'd help to have the metadata in a consistent manner.
67
+
Support has been added for templates which allows you to specify templates and tokens. A few sample tokens have been provided.
68
+
Common and provider agnostic tokens are processed in `src/TemplateParser/Base.php` whereas provider specific tokens are parsed in their specific handlers present in `src/TemplateParser`.
69
+
70
+
The templates have to be stored in the templates directory, and the file name provided as the second argument to `OutCompute\CloudMetaData\MetaData()::get()`.
71
+
```php
72
+
<?php
73
+
include_once('vendor/autoload.php');
74
+
75
+
$metaObject = new OutCompute\CloudMetaData\MetaData();
The tokens don't have to follow the heirarchy from the templates they are included in and can be any string as long as they are handled in any parser. The initial set of supported tokens seem to follow the heirarchy in basic.json with a dot(.) as a separator, but that is not a strict requirement.
45
81
82
+
However, if you're contributing to the repository then it'd be great if the tokens followed some structure.
46
83
47
84
### TODO
48
85
49
-
- Add other cloud providers, eg: Google Cloud, Microsoft Azure, Linode, etc.
86
+
- Add other cloud providers, eg: Linode, etc.
50
87
- Add test cases
51
88
- General improvements
52
-
89
+
- Supporting templates in varied configurations and extending the set of supported tokens
0 commit comments