From 1142c27bd8bfee92a34d4284fb6b544359857e29 Mon Sep 17 00:00:00 2001 From: VaishnaviGopal Date: Fri, 17 Nov 2023 19:03:07 +0530 Subject: [PATCH] Added fields name,default to workspace template_values_metadata --- .../data_source_ibm_schematics_workspace.go | 13 +++++++------ .../resource_ibm_schematics_workspace.go | 19 ++++++++++++------- .../docs/d/schematics_workspace.html.markdown | 3 ++- .../docs/r/schematics_workspace.html.markdown | 3 ++- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/ibm/service/schematics/data_source_ibm_schematics_workspace.go b/ibm/service/schematics/data_source_ibm_schematics_workspace.go index d6855d253f..69408e2c12 100644 --- a/ibm/service/schematics/data_source_ibm_schematics_workspace.go +++ b/ibm/service/schematics/data_source_ibm_schematics_workspace.go @@ -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, @@ -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.", @@ -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 diff --git a/ibm/service/schematics/resource_ibm_schematics_workspace.go b/ibm/service/schematics/resource_ibm_schematics_workspace.go index b6309bf51d..f4c87066b6 100644 --- a/ibm/service/schematics/resource_ibm_schematics_workspace.go +++ b/ibm/service/schematics/resource_ibm_schematics_workspace.go @@ -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, @@ -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.", @@ -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 } @@ -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 } @@ -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 } diff --git a/website/docs/d/schematics_workspace.html.markdown b/website/docs/d/schematics_workspace.html.markdown index 7b5e7aa29c..dfadec7f5c 100644 --- a/website/docs/d/schematics_workspace.html.markdown +++ b/website/docs/d/schematics_workspace.html.markdown @@ -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. @@ -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?. diff --git a/website/docs/r/schematics_workspace.html.markdown b/website/docs/r/schematics_workspace.html.markdown index 69d51cd954..4e3a390a4c 100644 --- a/website/docs/r/schematics_workspace.html.markdown +++ b/website/docs/r/schematics_workspace.html.markdown @@ -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. @@ -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?.