Managing shared parameters
Shared parameters define shared configuration to store data and are used by templates.
The Data Types and Data Objects are constructs that are used to capture these shared configurations. These are essentially pointers to data structures that facilitate the dynamic binding at run time. You can create and manage Data Types and Data Objects in Managed services console. In addition, whenever you import a template from Git repository, the Data Types of the template are also imported.
Data Types
The Data Types defines the data. Data Types contains the metadata of the attributes like name, attribute type and default values. For example, you can have a data type IBM_Tivoli_Directory_Structure
to encapsulate the attributes of
your LDAP server and then you can create a data object, an instance of this data type, that contains the values for these attributes which can be referenced in the template during deployment.
There are two types of Data Types:
-
Explicit Data Types
An administrator creates an explicit datatype either through a REST call or from the Admin Console UI. To create Data Type from the user interface, see Managing Datatypes from the user interface. To create Data Type by using REST APIs, see Shared parameters APIs. The name of the Data Types must be unique and for explicit data types the name must contain only alphanumeric and "_-" characters, and must start with an alphanumeric character.
-
Implicit Data Types
As Data Types and Data Objects are pointers to data structures, most of the existing constructs in Managed services can be referenced through an implicit Data Types. A use case for implicit data type is creation and use of a new cloud connection on the run without having to pre-define the cloud connection. This is very powerful when you have a service composed of multiple templates, and one of the templates depends on the cloud connection created by the template run prior to it. A cloud connection type can be referenced by
com.ibm.cloud.cloudconnections
followed by the provider name as followscom.ibm.cloud.cloudconnections.mycloud
. Any data object instance of this datatype, for example,com.ibm.cam.provider.mycloud.dev_acccount
points to this cloud connection.You can define these implicit data types and objects in the
output_datatypes
section of camvariables.json file as follows in your template. On deployment of the template a new cloud connectioncom.ibm.cloud.cloudconnections.mycloud.dev_acccount
with atttributesusername
,password
andserver
with their correspoding values will be created and can be used by other templates."output_datatypes": [ { "name": "com.ibm.cloud.cloudconnections.mycloud", "dataobject": { "name": "dev_acccount", "attributes": [ { "name": "username", "value": "${template_input_params.admin_user}" }, { "name": "password", "value": "${template_input_params.admin_password}" }, { "name": "server", "value": "${template_output_params.private_master_ip}" } ] } } ],
Data Types lookup
Data Types lookup is the mechanism to reference a Data Type to retrieve the dataobjects associated with it. The API representation is POST datatypes/lookup
wherein the Data Type is passed as a parameter in the body. For more information,
see Shared parameters APIs.
Data Objects
The Data Objects represent an instantiation of a Data Type. For example, if you have a data type IBM_Tivoli_Directory_Structure
that encapsulates your LDAP server, then you can create the following instances IBM_Tivoli_Directory_Structure
of Data Type to represent the LDAP server for different environments.
Development_IBM_Tivoli_Directory_Structure
Test_IBM_Tivoli_Directory_Structure
Production_IBM_Tivoli_Directory_Structure
The Data Objects inherit the attributes of the parent Data Type. If no value is provided for an attribute, the default value from the Data Type definition is used.
To create Data Object from the user interface, see Managing Dataobjects from the user interface. For more information about the REST APIs, see Shared parameter APIs.
Create Data Types and Data Objects from user interface
The following links provide the steps to create Data Types and Data Objects from the Manage > Shared parameters tab of the user interface:
Import Data Types from Git repository
To import Data Types, the template must have a datatypes folder with JSON and readme files. If the JSON is not properly defined, then the Data Types are not imported. To resolve this issue, fix the template and reimport the template. If the Data Types are already defined, then they are not overwritten during the template import.