use of alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest in project alien4cloud by alien4cloud.
the class SecuredResourceStepDefinition method iRevokeAccessToTheResourceTypeNamedFromTheApplication.
@Given("^I revoke access to the resource type \"([^\"]*)\" named \"([^\"]*)\" from the application \"([^\"]*)\"$")
public void iRevokeAccessToTheResourceTypeNamedFromTheApplication(String resourceType, String resourceName, String applicationName) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setApplicationsToDelete(new String[] { Context.getInstance().getApplicationId(applicationName) });
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(getSecuredResourceBaseURL(resourceType, resourceName) + "/environmentsPerApplication/", JsonUtil.toString(request)));
}
use of alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest in project alien4cloud by alien4cloud.
the class SecuredResourceStepDefinition method iGrantAccessToTheResourcesTypeToTheApplicationEnvironment.
@Given("^I (successfully\\s)?grant access to the resources type \"([^\"]*)\" to the environment \"([^\"]*)\" of the application \"([^\"]*)\"$")
public void iGrantAccessToTheResourcesTypeToTheApplicationEnvironment(String successfully, String resourceType, String environmentName, String applicationName, List<String> resourcesNames) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setEnvironmentsToAdd(new String[] { Context.getInstance().getApplicationEnvironmentId(applicationName, environmentName) });
request.setResources(getResourcesIds(resourcesNames));
String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
url += "/environmentsPerApplication";
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
use of alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest in project alien4cloud by alien4cloud.
the class SecuredResourceStepDefinition method iGrantAccessToTheResourceTypeNamedToTheEnvironmentTypeOfTheApplication.
@Given("^I (successfully\\s)?grant access to the resource type \"([^\"]*)\" named \"([^\"]*)\" to the environment type \"([^\"]*)\" of the application \"([^\"]*)\"$")
public void iGrantAccessToTheResourceTypeNamedToTheEnvironmentTypeOfTheApplication(String successfully, String resourceType, String resourceName, String environmentType, String applicationName) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setEnvironmentTypesToAdd(new String[] { Context.getInstance().getApplicationId(applicationName) + ":" + environmentType });
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(getSecuredResourceBaseURL(resourceType, resourceName) + "/environmentsPerApplication/", JsonUtil.toString(request)));
CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
use of alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest in project alien4cloud by alien4cloud.
the class SecuredResourceStepDefinition method iGrantAccessToTheResourcesTypeToTheApplication.
@Given("^I (successfully\\s)?grant access to the resources type \"([^\"]*)\" to the application \"([^\"]*)\"$")
public void iGrantAccessToTheResourcesTypeToTheApplication(String successfully, String resourceType, String applicationName, List<String> resourcesNames) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setApplicationsToAdd(new String[] { Context.getInstance().getApplicationId(applicationName) });
request.setResources(getResourcesIds(resourcesNames));
String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
url += "/environmentsPerApplication";
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
use of alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest in project alien4cloud by alien4cloud.
the class SecuredResourceStepDefinition method iRevokeAccessToTheResourcesTypeToTheApplication.
@Given("^I (successfully\\s)?revoke access to the resources type \"([^\"]*)\" from the application \"([^\"]*)\"$")
public void iRevokeAccessToTheResourcesTypeToTheApplication(String successfully, String resourceType, String applicationName, List<String> resourcesNames) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setApplicationsToDelete(new String[] { Context.getInstance().getApplicationId(applicationName) });
request.setResources(getResourcesIds(resourcesNames));
String oneResourceName = CollectionUtils.isEmpty(resourcesNames) ? null : resourcesNames.get(0);
String url = getBatchSecuredResourceBaseURL(resourceType, oneResourceName);
url += "/environmentsPerApplication";
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(request)));
CommonStepDefinitions.validateIfNeeded(StringUtils.isNotBlank(successfully));
}
Aggregations