@Test(expected = IllegalArgumentException.class) public void createVariable() throws Exception { VariableImpl.createVariable(getTerraformVariableInputs); }
@NotNull public static Map<String, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { 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 (commonInputs.getRequestBody().isEmpty() & terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); } else if (!terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(terraformVariableInputs.getSensitiveVariableRequestBody()); } else { httpClientInputs.setBody(commonInputs.getRequestBody()); } httpClientInputs.setResponseCharacterSet(commonInputs.getResponseCharacterSet()); return new HttpClientService().execute(httpClientInputs); }
VariableImpl { @NotNull public static Map<String, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { 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 (commonInputs.getRequestBody().isEmpty() & terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); } else if (!terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(terraformVariableInputs.getSensitiveVariableRequestBody()); } else { httpClientInputs.setBody(commonInputs.getRequestBody()); } httpClientInputs.setResponseCharacterSet(commonInputs.getResponseCharacterSet()); return new HttpClientService().execute(httpClientInputs); } }
VariableImpl { @NotNull public static Map<String, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { 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 (commonInputs.getRequestBody().isEmpty() & terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); } else if (!terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(terraformVariableInputs.getSensitiveVariableRequestBody()); } else { httpClientInputs.setBody(commonInputs.getRequestBody()); } httpClientInputs.setResponseCharacterSet(commonInputs.getResponseCharacterSet()); return new HttpClientService().execute(httpClientInputs); }  }
VariableImpl { @NotNull public static Map<String, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { 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 (commonInputs.getRequestBody().isEmpty() & terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); } else if (!terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(terraformVariableInputs.getSensitiveVariableRequestBody()); } else { httpClientInputs.setBody(commonInputs.getRequestBody()); } httpClientInputs.setResponseCharacterSet(commonInputs.getResponseCharacterSet()); return new HttpClientService().execute(httpClientInputs); }  @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, String> createVariable(@NotNull TerraformVariableInputs terraformVariableInputs) throws Exception { 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 (commonInputs.getRequestBody().isEmpty() & terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(createVariableRequestBody(terraformVariableInputs)); } else if (!terraformVariableInputs.getSensitiveVariableRequestBody().isEmpty()) { httpClientInputs.setBody(terraformVariableInputs.getSensitiveVariableRequestBody()); } else { httpClientInputs.setBody(commonInputs.getRequestBody()); } httpClientInputs.setResponseCharacterSet(commonInputs.getResponseCharacterSet()); return new HttpClientService().execute(httpClientInputs); }  @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);  }