Search in sources :

Example 1 with ApplicationEnvironmentAuthorizationUpdateRequest

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

Example 2 with ApplicationEnvironmentAuthorizationUpdateRequest

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

Example 3 with ApplicationEnvironmentAuthorizationUpdateRequest

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

Example 4 with ApplicationEnvironmentAuthorizationUpdateRequest

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

Example 5 with ApplicationEnvironmentAuthorizationUpdateRequest

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)));
}
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