@Test public void createVariables() throws Exception{ Map<String,Map<String,String>> createVariablesResult= VariableImpl.createVariables(getTerraformVariableInputs); assertEquals(0,createVariablesResult.size()); }
@NotNull public static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { String variableName; String variableValue; String hcl; String catagory; Map<String, Map<String, String>> createVariableMap = new HashMap<>(); JSONParser parser = new JSONParser(); final HttpClientInputs httpClientInputs = new HttpClientInputs(); final TerraformCommonInputs commonInputs = terraformVariableInputs.getCommonInputs(); httpClientInputs.setUrl(createVariableUrl()); setCommonHttpInputs(httpClientInputs, commonInputs); httpClientInputs.setAuthType(ANONYMOUS); httpClientInputs.setMethod(POST); httpClientInputs.setContentType(APPLICATION_VND_API_JSON); httpClientInputs.setHeaders(getAuthHeaders(commonInputs.getAuthToken())); if (!terraformVariableInputs.getVariableJson().isEmpty() & !terraformVariableInputs.getSensitiveVariableJson().isEmpty()) { String sensitiveVariableValue; JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createVariableJson; JSONObject createSensitiveVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); sensitiveVariableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(sensitiveVariableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else if (!terraformVariableInputs.getVariableJson().isEmpty()) { JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONObject createVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else { JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createSensitiveVariableJson; for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); variableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(variableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } }
VariableImpl { @NotNull public static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { String variableName; String variableValue; String hcl; String catagory; Map<String, Map<String, String>> createVariableMap = new HashMap<>(); JSONParser parser = new JSONParser(); final HttpClientInputs httpClientInputs = new HttpClientInputs(); final TerraformCommonInputs commonInputs = terraformVariableInputs.getCommonInputs(); httpClientInputs.setUrl(createVariableUrl()); setCommonHttpInputs(httpClientInputs, commonInputs); httpClientInputs.setAuthType(ANONYMOUS); httpClientInputs.setMethod(POST); httpClientInputs.setContentType(APPLICATION_VND_API_JSON); httpClientInputs.setHeaders(getAuthHeaders(commonInputs.getAuthToken())); if (!terraformVariableInputs.getVariableJson().isEmpty() & !terraformVariableInputs.getSensitiveVariableJson().isEmpty()) { String sensitiveVariableValue; JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createVariableJson; JSONObject createSensitiveVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); sensitiveVariableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(sensitiveVariableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else if (!terraformVariableInputs.getVariableJson().isEmpty()) { JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONObject createVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else { JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createSensitiveVariableJson; for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); variableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(variableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } } }
VariableImpl { @NotNull public static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { String variableName; String variableValue; String hcl; String catagory; Map<String, Map<String, String>> createVariableMap = new HashMap<>(); JSONParser parser = new JSONParser(); final HttpClientInputs httpClientInputs = new HttpClientInputs(); final TerraformCommonInputs commonInputs = terraformVariableInputs.getCommonInputs(); httpClientInputs.setUrl(createVariableUrl()); setCommonHttpInputs(httpClientInputs, commonInputs); httpClientInputs.setAuthType(ANONYMOUS); httpClientInputs.setMethod(POST); httpClientInputs.setContentType(APPLICATION_VND_API_JSON); httpClientInputs.setHeaders(getAuthHeaders(commonInputs.getAuthToken())); if (!terraformVariableInputs.getVariableJson().isEmpty() & !terraformVariableInputs.getSensitiveVariableJson().isEmpty()) { String sensitiveVariableValue; JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createVariableJson; JSONObject createSensitiveVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); sensitiveVariableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(sensitiveVariableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else if (!terraformVariableInputs.getVariableJson().isEmpty()) { JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONObject createVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else { JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createSensitiveVariableJson; for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); variableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(variableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } }  }
VariableImpl { @NotNull public static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { String variableName; String variableValue; String hcl; String catagory; Map<String, Map<String, String>> createVariableMap = new HashMap<>(); JSONParser parser = new JSONParser(); final HttpClientInputs httpClientInputs = new HttpClientInputs(); final TerraformCommonInputs commonInputs = terraformVariableInputs.getCommonInputs(); httpClientInputs.setUrl(createVariableUrl()); setCommonHttpInputs(httpClientInputs, commonInputs); httpClientInputs.setAuthType(ANONYMOUS); httpClientInputs.setMethod(POST); httpClientInputs.setContentType(APPLICATION_VND_API_JSON); httpClientInputs.setHeaders(getAuthHeaders(commonInputs.getAuthToken())); if (!terraformVariableInputs.getVariableJson().isEmpty() & !terraformVariableInputs.getSensitiveVariableJson().isEmpty()) { String sensitiveVariableValue; JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createVariableJson; JSONObject createSensitiveVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); sensitiveVariableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(sensitiveVariableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else if (!terraformVariableInputs.getVariableJson().isEmpty()) { JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONObject createVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else { JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createSensitiveVariableJson; for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); variableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(variableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } }  @NotNull static Map<String, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs); @NotNull static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs); @NotNull static Map<String, Map<String, String>> updateVariables(@NotNull TerraformVariableInputs terraformVariableInputs, @NotNull TerraformWorkspaceInputs terraformWorkspaceInputs); @NotNull static Map<String, String> getVariablesOperationOutput(String variablesJson, String sensitiveVariablesJson, Map<String, Map<String, String>> result); @NotNull static Map<String, String> listVariables(@NotNull final TerraformWorkspaceInputs terraformWorkspaceInputs); @NotNull static String listVariablesUrl(); @NotNull static String getListVariableQueryParams(String organizationName,
                                                    final String workspaceName); @NotNull static String getVariablePath(); static Map<String, String> updateVariable(@NotNull final TerraformVariableInputs updateVariableInputs); @NotNull static Map<String, String> deleteVariable(@NotNull final TerraformVariableInputs deleteVariableInputs); @NotNull static String getVariablePath(@NotNull final String variableId); @NotNull static String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs); @NotNull static String updateVariableRequestBody(TerraformVariableInputs terraformVariableInputs); }
VariableImpl { @NotNull public static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { String variableName; String variableValue; String hcl; String catagory; Map<String, Map<String, String>> createVariableMap = new HashMap<>(); JSONParser parser = new JSONParser(); final HttpClientInputs httpClientInputs = new HttpClientInputs(); final TerraformCommonInputs commonInputs = terraformVariableInputs.getCommonInputs(); httpClientInputs.setUrl(createVariableUrl()); setCommonHttpInputs(httpClientInputs, commonInputs); httpClientInputs.setAuthType(ANONYMOUS); httpClientInputs.setMethod(POST); httpClientInputs.setContentType(APPLICATION_VND_API_JSON); httpClientInputs.setHeaders(getAuthHeaders(commonInputs.getAuthToken())); if (!terraformVariableInputs.getVariableJson().isEmpty() & !terraformVariableInputs.getSensitiveVariableJson().isEmpty()) { String sensitiveVariableValue; JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createVariableJson; JSONObject createSensitiveVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); sensitiveVariableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(sensitiveVariableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else if (!terraformVariableInputs.getVariableJson().isEmpty()) { JSONArray createVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getVariableJson()); JSONObject createVariableJson; for (int i = 0; i < createVariableJsonArray.size(); i++) { createVariableJson = (JSONObject) createVariableJsonArray.get(i); variableName = (String) createVariableJson.get("propertyName"); variableValue = (String) createVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createVariableJson.get("HCL")); catagory = (String) createVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .variableValue(variableValue) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("false").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } else { JSONArray createSensitiveVariableJsonArray = (JSONArray) parser.parse(terraformVariableInputs.getSensitiveVariableJson()); JSONObject createSensitiveVariableJson; for (int i = 0; i < createSensitiveVariableJsonArray.size(); i++) { createSensitiveVariableJson = (JSONObject) createSensitiveVariableJsonArray.get(i); variableName = (String) createSensitiveVariableJson.get("propertyName"); variableValue = (String) createSensitiveVariableJson.get("propertyValue"); hcl = Boolean.toString((boolean) createSensitiveVariableJson.get("HCL")); catagory = (String) createSensitiveVariableJson.get("Category"); terraformVariableInputs = TerraformVariableInputs.builder() .variableName(variableName) .sensitiveVariableValue(variableValue) .variableValue(EMPTY) .variableCategory(catagory) .hcl(hcl) .workspaceId(terraformVariableInputs.getWorkspaceId()) .sensitive("true").build(); httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); createVariableMap.put(variableName, new HttpClientService().execute(httpClientInputs)); } return createVariableMap; } }  @NotNull static Map<String, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs); @NotNull static Map<String, Map<String, String>> createVariables(@NotNull TerraformVariableInputs terraformVariableInputs); @NotNull static Map<String, Map<String, String>> updateVariables(@NotNull TerraformVariableInputs terraformVariableInputs, @NotNull TerraformWorkspaceInputs terraformWorkspaceInputs); @NotNull static Map<String, String> getVariablesOperationOutput(String variablesJson, String sensitiveVariablesJson, Map<String, Map<String, String>> result); @NotNull static Map<String, String> listVariables(@NotNull final TerraformWorkspaceInputs terraformWorkspaceInputs); @NotNull static String listVariablesUrl(); @NotNull static String getListVariableQueryParams(String organizationName,
                                                    final String workspaceName); @NotNull static String getVariablePath(); static Map<String, String> updateVariable(@NotNull final TerraformVariableInputs updateVariableInputs); @NotNull static Map<String, String> deleteVariable(@NotNull final TerraformVariableInputs deleteVariableInputs); @NotNull static String getVariablePath(@NotNull final String variableId); @NotNull static String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs); @NotNull static String updateVariableRequestBody(TerraformVariableInputs terraformVariableInputs);  }