use of alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest in project alien4cloud by alien4cloud.
the class SecuredResourceStepDefinition method iGrantAccessToTheResourceTypeNamedToTheEnvironmentOfTheApplication.
@Given("^I (successfully\\s)?grant access to the resource type \"([^\"]*)\" named \"([^\"]*)\" to the environment \"([^\"]*)\" of the application \"([^\"]*)\"$")
public void iGrantAccessToTheResourceTypeNamedToTheEnvironmentOfTheApplication(String successfully, String resourceType, String resourceName, String environmentName, String applicationName) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setEnvironmentsToAdd(new String[] { Context.getInstance().getApplicationEnvironmentId(applicationName, environmentName) });
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 iGrantAccessToTheResourceTypeNamedToTheApplication.
@Given("^I (successfully\\s)?grant access to the resource type \"([^\"]*)\" named \"([^\"]*)\" to the application \"([^\"]*)\"$")
public void iGrantAccessToTheResourceTypeNamedToTheApplication(String successfully, String resourceType, String resourceName, String applicationName) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setApplicationsToAdd(new String[] { Context.getInstance().getApplicationId(applicationName) });
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 iRevokeAccessToTheResourcesTypeToTheApplicationEnvironment.
@Given("^I (successfully\\s)?revoke access to the resources type \"([^\"]*)\" from the environment \"([^\"]*)\" of the application \"([^\"]*)\"$")
public void iRevokeAccessToTheResourcesTypeToTheApplicationEnvironment(String successfully, String resourceType, String environmentName, String applicationName, List<String> resourcesNames) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setEnvironmentsToDelete(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 iRevokeAccessToTheResourceTypeNamedFromTheEnvironmentOfTheApplication.
@Given("^I revoke access to the resource type \"([^\"]*)\" named \"([^\"]*)\" from the environment \"([^\"]*)\" of the application \"([^\"]*)\"$")
public void iRevokeAccessToTheResourceTypeNamedFromTheEnvironmentOfTheApplication(String resourceType, String resourceName, String environmentName, String applicationName) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setEnvironmentsToDelete(new String[] { Context.getInstance().getApplicationEnvironmentId(applicationName, environmentName) });
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 iRevokeAccessToTheResourceTypeNamedFromTheEnvironmentTypeOfTheApplication.
@Given("^I revoke access to the resource type \"([^\"]*)\" named \"([^\"]*)\" from the environment type \"([^\"]*)\" of the application \"([^\"]*)\"$")
public void iRevokeAccessToTheResourceTypeNamedFromTheEnvironmentTypeOfTheApplication(String resourceType, String resourceName, String environmentType, String applicationName) throws Throwable {
ApplicationEnvironmentAuthorizationUpdateRequest request = new ApplicationEnvironmentAuthorizationUpdateRequest();
request.setEnvironmentTypesToDelete(new String[] { Context.getInstance().getApplicationId(applicationName) + ":" + environmentType });
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(getSecuredResourceBaseURL(resourceType, resourceName) + "/environmentsPerApplication/", JsonUtil.toString(request)));
}
Aggregations