use of jetbrains.buildServer.clouds.server.CloudManager in project teamcity-rest by JetBrains.
the class AbstractAgentPoolResolverTest method setUp.
@Override
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
super.setUp();
myActionChecker = new AgentPoolAccessCheckerForTests();
SecuredProjectManager projectManager = new SecuredProjectManager(myFixture.getSecurityContext());
projectManager.setDelegate(myProjectManager);
Mock cloudManagerMock = mock(CloudManager.class);
myResolver = new AbstractAgentPoolResolver(projectManager, myActionChecker, // not actually used in tests
(CloudManager) cloudManagerMock.proxy(), myFixture.getAgentTypeFinder(), myServer.getSecurityContext());
}
use of jetbrains.buildServer.clouds.server.CloudManager in project teamcity-rest by JetBrains.
the class CloudInstance method startInstance.
@Nullable
public jetbrains.buildServer.clouds.CloudInstance startInstance(@NotNull final SUser user, @NotNull final ServiceLocator serviceLocator) {
if (submittedImage == null) {
throw new BadRequestException("Cloud Instance should contain image");
}
CloudUtil util = serviceLocator.getSingletonService(CloudUtil.class);
jetbrains.buildServer.clouds.CloudImage image = submittedImage.getFromPosted(serviceLocator);
String profileId = util.getProfileId(image);
if (profileId == null) {
throw new InvalidStateException("Cannot find profile for the cloud image");
}
CloudManager cloudManager = serviceLocator.getSingletonService(CloudManager.class);
cloudManager.startInstance(profileId, image.getId(), StartInstanceReason.userAction(user));
return null;
}
Aggregations