Skip to content

Commit

Permalink
Added fields name,default to workspace template_values_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
VaishnaviGopal authored and hkantare committed Nov 20, 2023
1 parent e69b93c commit 1142c27
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
13 changes: 7 additions & 6 deletions ibm/service/schematics/data_source_ibm_schematics_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource {
Description: "A list of input variables that are associated with the workspace.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Name of the variable.",
},
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand All @@ -323,7 +328,7 @@ func DataSourceIBMSchematicsWorkspace() *schema.Resource {
Computed: true,
Description: "Cloud data type of the variable. eg. resource_group_id, region, vpc_id.",
},
"default_value": &schema.Schema{
"default": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Default value for the variable only if the override value is not specified.",
Expand Down Expand Up @@ -915,11 +920,7 @@ func dataSourceWorkspaceResponseTemplateDataToMap(templateDataItem schematicsv1.
templateDataMap["values"] = templateDataItem.Values
}
if templateDataItem.ValuesMetadata != nil {
valuesMetadata := []map[string]interface{}{}
for _, valuesMetadataItem := range templateDataItem.ValuesMetadata {
valuesMetadata = append(valuesMetadata, valuesMetadataItem)
}
templateDataMap["values_metadata"] = valuesMetadata
templateDataMap["values_metadata"] = templateDataItem.ValuesMetadata
}
if templateDataItem.ValuesURL != nil {
templateDataMap["values_url"] = templateDataItem.ValuesURL
Expand Down
19 changes: 12 additions & 7 deletions ibm/service/schematics/resource_ibm_schematics_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ func ResourceIBMSchematicsWorkspace() *schema.Resource {
Description: "List of values metadata.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Name of the variable.",
},
"type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand All @@ -249,7 +254,7 @@ func ResourceIBMSchematicsWorkspace() *schema.Resource {
Computed: true,
Description: "Cloud data type of the variable. eg. resource_group_id, region, vpc_id.",
},
"default_value": &schema.Schema{
"default": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Default value for the variable only if the override value is not specified.",
Expand Down Expand Up @@ -808,8 +813,8 @@ func resourceIBMSchematicsWorkspaceMapToSharedTargetData(sharedTargetDataMap map
}
if sharedTargetDataMap["entitlement_keys"] != nil {
entitlementKeys := []map[string]interface{}{}
for _, entitlementKeysItem := range sharedTargetDataMap["entitlement_keys"].([]map[string]interface{}) {
entitlementKeys = append(entitlementKeys, entitlementKeysItem)
for _, entitlementKeysItem := range sharedTargetDataMap["entitlement_keys"].([]interface{}) {
entitlementKeys = append(entitlementKeys, entitlementKeysItem.(map[string]interface{}))
}
sharedTargetData.EntitlementKeys = entitlementKeys
}
Expand Down Expand Up @@ -837,8 +842,8 @@ func resourceIBMSchematicsWorkspaceMapToTemplateSourceDataRequest(templateSource

if templateSourceDataRequestMap["env_values"] != nil {
envValues := []map[string]interface{}{}
for _, envValuesItem := range templateSourceDataRequestMap["env_values"].([]map[string]interface{}) {
envValues = append(envValues, envValuesItem)
for _, envValuesItem := range templateSourceDataRequestMap["env_values"].([]interface{}) {
envValues = append(envValues, envValuesItem.(map[string]interface{}))
}
templateSourceDataRequest.EnvValues = envValues
}
Expand All @@ -862,8 +867,8 @@ func resourceIBMSchematicsWorkspaceMapToTemplateSourceDataRequest(templateSource
}
if templateSourceDataRequestMap["values_metadata"] != nil {
valuesMetadata := []map[string]interface{}{}
for _, valuesMetadataItem := range templateSourceDataRequestMap["values_metadata"].([]map[string]interface{}) {
valuesMetadata = append(valuesMetadata, valuesMetadataItem)
for _, valuesMetadataItem := range templateSourceDataRequestMap["values_metadata"].([]interface{}) {
valuesMetadata = append(valuesMetadata, valuesMetadataItem.(map[string]interface{}))
}
templateSourceDataRequest.ValuesMetadata = valuesMetadata
}
Expand Down
3 changes: 2 additions & 1 deletion website/docs/d/schematics_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Nested scheme for **env_values**:
Nested scheme for **values_metadata**:
* `aliases` - (List) The list of aliases for the variable name.
* `cloud_data_type` - (String) Cloud data type of the variable. eg. resource_group_id, region, vpc_id.
* `default_value` - (String) Default value for the variable only if the override value is not specified.
* `default` - (String) Default value for the variable only if the override value is not specified.
* `description` - (String) The description of the meta data.
* `group_by` - (String) The display name of the group this variable belongs to.
* `hidden` - (Boolean) If **true**, the variable is not displayed on UI or Command line.
Expand All @@ -117,6 +117,7 @@ Nested scheme for **env_values**:
* `max_value` - (Integer) The maximum value of the variable. Applicable for the integer type.
* `min_length` - (Integer) The minimum length of the variable value. Applicable for the string type.
* `min_value` - (Integer) The minimum value of the variable. Applicable for the integer type.
* `name` - (String) Name of the variable.
* `options` - (List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime.
* `position` - (Integer) The relative position of this variable in a list.
* `required` - (Boolean) If the variable required?.
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/schematics_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Nested scheme for **shared_data**:
Nested scheme for **template_values_metadata**:
* `aliases` - (Optional, List) The list of aliases for the variable name.
* `cloud_data_type` - (Optional, String) Cloud data type of the variable. eg. resource_group_id, region, vpc_id.
* `default_value` - (Optional, String) Default value for the variable only if the override value is not specified.
* `default` - (Optional, String) Default value for the variable only if the override value is not specified.
* `description` - (Optional, String) The description of the meta data.
* `group_by` - (Optional, String) The display name of the group this variable belongs to.
* `hidden` - (Optional, Boolean) If **true**, the variable is not displayed on UI or Command line.
Expand All @@ -79,6 +79,7 @@ Nested scheme for **template_values_metadata**:
* `max_value` - (Optional, Integer) The maximum value of the variable. Applicable for the integer type.
* `min_length` - (Optional, Integer) The minimum length of the variable value. Applicable for the string type.
* `min_value` - (Optional, Integer) The minimum value of the variable. Applicable for the integer type.
* `name` - (String) Name of the variable.
* `options` - (Optional, List) The list of possible values for this variable. If type is **integer** or **date**, then the array of string is converted to array of integers or date during the runtime.
* `position` - (Optional, Integer) The relative position of this variable in a list.
* `required` - (Optional, Boolean) If the variable required?.
Expand Down

0 comments on commit 1142c27

Please sign in to comment.