@Test public void getCreateVariableBody() { String createVariableBody = VariableImpl.createVariableRequestBody(terraformVariableInputs); assertEquals(EXPECTED_CREATE_VARIABLE_BODY, createVariableBody); }
@NotNull public static String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs) { String requestBody = EMPTY; ObjectMapper createVariableMapper = new ObjectMapper(); CreateVariableRequestBody createVariableRequestBody = new CreateVariableRequestBody(); CreateVariableRequestBody.CreateVariableData createVariableData = createVariableRequestBody.new CreateVariableData(); createVariableData.setType(VARIABLE_TYPE); CreateVariableRequestBody.Attributes attributes = createVariableRequestBody.new Attributes(); attributes.setKey(terraformVariableInputs.getVariableName()); if (terraformVariableInputs.getVariableValue().isEmpty()) { attributes.setValue(terraformVariableInputs.getSensitiveVariableValue()); } else { attributes.setValue(terraformVariableInputs.getVariableValue()); } attributes.setCategory(terraformVariableInputs.getVariableCategory()); attributes.setHcl(terraformVariableInputs.getHcl()); attributes.setSensitive(terraformVariableInputs.getSensitive()); CreateVariableRequestBody.Data data = createVariableRequestBody.new Data(); data.setId(terraformVariableInputs.getWorkspaceId()); data.setType(WORKSPACE_TYPE); CreateVariableRequestBody.Workspace workspace = createVariableRequestBody.new Workspace(); workspace.setData(data); CreateVariableRequestBody.Relationships relationships = createVariableRequestBody.new Relationships(); relationships.setWorkspace(workspace); createVariableData.setRelationships(relationships); createVariableData.setAttributes(attributes); createVariableRequestBody.setData(createVariableData); try { requestBody = createVariableMapper.writeValueAsString(createVariableRequestBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }
VariableImpl { @NotNull public static String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs) { String requestBody = EMPTY; ObjectMapper createVariableMapper = new ObjectMapper(); CreateVariableRequestBody createVariableRequestBody = new CreateVariableRequestBody(); CreateVariableRequestBody.CreateVariableData createVariableData = createVariableRequestBody.new CreateVariableData(); createVariableData.setType(VARIABLE_TYPE); CreateVariableRequestBody.Attributes attributes = createVariableRequestBody.new Attributes(); attributes.setKey(terraformVariableInputs.getVariableName()); if (terraformVariableInputs.getVariableValue().isEmpty()) { attributes.setValue(terraformVariableInputs.getSensitiveVariableValue()); } else { attributes.setValue(terraformVariableInputs.getVariableValue()); } attributes.setCategory(terraformVariableInputs.getVariableCategory()); attributes.setHcl(terraformVariableInputs.getHcl()); attributes.setSensitive(terraformVariableInputs.getSensitive()); CreateVariableRequestBody.Data data = createVariableRequestBody.new Data(); data.setId(terraformVariableInputs.getWorkspaceId()); data.setType(WORKSPACE_TYPE); CreateVariableRequestBody.Workspace workspace = createVariableRequestBody.new Workspace(); workspace.setData(data); CreateVariableRequestBody.Relationships relationships = createVariableRequestBody.new Relationships(); relationships.setWorkspace(workspace); createVariableData.setRelationships(relationships); createVariableData.setAttributes(attributes); createVariableRequestBody.setData(createVariableData); try { requestBody = createVariableMapper.writeValueAsString(createVariableRequestBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; } }
VariableImpl { @NotNull public static String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs) { String requestBody = EMPTY; ObjectMapper createVariableMapper = new ObjectMapper(); CreateVariableRequestBody createVariableRequestBody = new CreateVariableRequestBody(); CreateVariableRequestBody.CreateVariableData createVariableData = createVariableRequestBody.new CreateVariableData(); createVariableData.setType(VARIABLE_TYPE); CreateVariableRequestBody.Attributes attributes = createVariableRequestBody.new Attributes(); attributes.setKey(terraformVariableInputs.getVariableName()); if (terraformVariableInputs.getVariableValue().isEmpty()) { attributes.setValue(terraformVariableInputs.getSensitiveVariableValue()); } else { attributes.setValue(terraformVariableInputs.getVariableValue()); } attributes.setCategory(terraformVariableInputs.getVariableCategory()); attributes.setHcl(terraformVariableInputs.getHcl()); attributes.setSensitive(terraformVariableInputs.getSensitive()); CreateVariableRequestBody.Data data = createVariableRequestBody.new Data(); data.setId(terraformVariableInputs.getWorkspaceId()); data.setType(WORKSPACE_TYPE); CreateVariableRequestBody.Workspace workspace = createVariableRequestBody.new Workspace(); workspace.setData(data); CreateVariableRequestBody.Relationships relationships = createVariableRequestBody.new Relationships(); relationships.setWorkspace(workspace); createVariableData.setRelationships(relationships); createVariableData.setAttributes(attributes); createVariableRequestBody.setData(createVariableData); try { requestBody = createVariableMapper.writeValueAsString(createVariableRequestBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }  }
VariableImpl { @NotNull public static String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs) { String requestBody = EMPTY; ObjectMapper createVariableMapper = new ObjectMapper(); CreateVariableRequestBody createVariableRequestBody = new CreateVariableRequestBody(); CreateVariableRequestBody.CreateVariableData createVariableData = createVariableRequestBody.new CreateVariableData(); createVariableData.setType(VARIABLE_TYPE); CreateVariableRequestBody.Attributes attributes = createVariableRequestBody.new Attributes(); attributes.setKey(terraformVariableInputs.getVariableName()); if (terraformVariableInputs.getVariableValue().isEmpty()) { attributes.setValue(terraformVariableInputs.getSensitiveVariableValue()); } else { attributes.setValue(terraformVariableInputs.getVariableValue()); } attributes.setCategory(terraformVariableInputs.getVariableCategory()); attributes.setHcl(terraformVariableInputs.getHcl()); attributes.setSensitive(terraformVariableInputs.getSensitive()); CreateVariableRequestBody.Data data = createVariableRequestBody.new Data(); data.setId(terraformVariableInputs.getWorkspaceId()); data.setType(WORKSPACE_TYPE); CreateVariableRequestBody.Workspace workspace = createVariableRequestBody.new Workspace(); workspace.setData(data); CreateVariableRequestBody.Relationships relationships = createVariableRequestBody.new Relationships(); relationships.setWorkspace(workspace); createVariableData.setRelationships(relationships); createVariableData.setAttributes(attributes); createVariableRequestBody.setData(createVariableData); try { requestBody = createVariableMapper.writeValueAsString(createVariableRequestBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }  @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 String createVariableRequestBody(TerraformVariableInputs terraformVariableInputs) { String requestBody = EMPTY; ObjectMapper createVariableMapper = new ObjectMapper(); CreateVariableRequestBody createVariableRequestBody = new CreateVariableRequestBody(); CreateVariableRequestBody.CreateVariableData createVariableData = createVariableRequestBody.new CreateVariableData(); createVariableData.setType(VARIABLE_TYPE); CreateVariableRequestBody.Attributes attributes = createVariableRequestBody.new Attributes(); attributes.setKey(terraformVariableInputs.getVariableName()); if (terraformVariableInputs.getVariableValue().isEmpty()) { attributes.setValue(terraformVariableInputs.getSensitiveVariableValue()); } else { attributes.setValue(terraformVariableInputs.getVariableValue()); } attributes.setCategory(terraformVariableInputs.getVariableCategory()); attributes.setHcl(terraformVariableInputs.getHcl()); attributes.setSensitive(terraformVariableInputs.getSensitive()); CreateVariableRequestBody.Data data = createVariableRequestBody.new Data(); data.setId(terraformVariableInputs.getWorkspaceId()); data.setType(WORKSPACE_TYPE); CreateVariableRequestBody.Workspace workspace = createVariableRequestBody.new Workspace(); workspace.setData(data); CreateVariableRequestBody.Relationships relationships = createVariableRequestBody.new Relationships(); relationships.setWorkspace(workspace); createVariableData.setRelationships(relationships); createVariableData.setAttributes(attributes); createVariableRequestBody.setData(createVariableData); try { requestBody = createVariableMapper.writeValueAsString(createVariableRequestBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }  @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);  }