Search in sources :

Example 6 with ApplicationEnvironmentAuthorizationUpdateRequest

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)));
}
Also used : ApplicationEnvironmentAuthorizationUpdateRequest(alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest) Given(cucumber.api.java.en.Given)

Example 7 with ApplicationEnvironmentAuthorizationUpdateRequest

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));
}
Also used : ApplicationEnvironmentAuthorizationUpdateRequest(alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest) Given(cucumber.api.java.en.Given)

Example 8 with ApplicationEnvironmentAuthorizationUpdateRequest

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));
}
Also used : ApplicationEnvironmentAuthorizationUpdateRequest(alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest) Given(cucumber.api.java.en.Given)

Example 9 with ApplicationEnvironmentAuthorizationUpdateRequest

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));
}
Also used : ApplicationEnvironmentAuthorizationUpdateRequest(alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest) Given(cucumber.api.java.en.Given)

Example 10 with ApplicationEnvironmentAuthorizationUpdateRequest

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));
}
Also used : ApplicationEnvironmentAuthorizationUpdateRequest(alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest) Given(cucumber.api.java.en.Given)

Aggregations

ApplicationEnvironmentAuthorizationUpdateRequest (alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest)12 Given (cucumber.api.java.en.Given)10 ApplicationEnvironmentService (alien4cloud.application.ApplicationEnvironmentService)2 Audit (alien4cloud.audit.annotation.Audit)2 ResourcePermissionService (alien4cloud.authorization.ResourcePermissionService)2 ApplicationEnvironment (alien4cloud.model.application.ApplicationEnvironment)2 AbstractLocationResourceTemplate (alien4cloud.model.orchestrators.locations.AbstractLocationResourceTemplate)2 Location (alien4cloud.model.orchestrators.locations.Location)2 ILocationResourceService (alien4cloud.orchestrators.locations.services.ILocationResourceService)2 LocationSecurityService (alien4cloud.orchestrators.locations.services.LocationSecurityService)2 LocationService (alien4cloud.orchestrators.locations.services.LocationService)2 RestResponse (alien4cloud.rest.model.RestResponse)2 RestResponseBuilder (alien4cloud.rest.model.RestResponseBuilder)2 Subject (alien4cloud.security.Subject)2 Sets (com.google.common.collect.Sets)2 ApiOperation (io.swagger.annotations.ApiOperation)2 Arrays (java.util.Arrays)2 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2