use of com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder in project cloudbreak by hortonworks.
the class CloudbreakUsageController method getDailyFlexUsages.
@Override
public CloudbreakFlexUsageJson getDailyFlexUsages() {
long fromDate = LocalDate.now().minusDays(1).atStartOfDay(systemDefault()).toInstant().toEpochMilli();
long endDate = LocalDate.now().atStartOfDay(systemDefault()).toInstant().toEpochMilli();
CbUsageFilterParameters cbUsageFilterParameters = new Builder().setSince(fromDate).setFilterEndDate(endDate).build();
return cloudbreakUsagesFacade.getFlexUsagesFor(cbUsageFilterParameters);
}
use of com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder in project cloudbreak by hortonworks.
the class CloudbreakUsageController method getAccount.
@Override
public List<CloudbreakUsageJson> getAccount(Long since, Long filterEndDate, String userId, String cloud, String zone) {
IdentityUser user = authenticatedUserService.getCbUser();
CbUsageFilterParameters params = new Builder().setAccount(user.getAccount()).setOwner(userId).setSince(since).setCloud(cloud).setRegion(zone).setFilterEndDate(filterEndDate).build();
return cloudbreakUsagesFacade.getUsagesFor(params);
}
use of com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder in project cloudbreak by hortonworks.
the class CloudbreakUsageController method getLatestFlexUsages.
@Override
public CloudbreakFlexUsageJson getLatestFlexUsages() {
long fromDate = LocalDate.now().atStartOfDay(systemDefault()).toInstant().toEpochMilli();
CbUsageFilterParameters cbUsageFilterParameters = new Builder().setSince(fromDate).build();
return cloudbreakUsagesFacade.getFlexUsagesFor(cbUsageFilterParameters);
}
use of com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder in project cloudbreak by hortonworks.
the class CloudbreakUsageController method getUser.
@Override
public List<CloudbreakUsageJson> getUser(Long since, Long filterEndDate, String cloud, String zone) {
IdentityUser user = authenticatedUserService.getCbUser();
CbUsageFilterParameters params = new Builder().setAccount(user.getAccount()).setOwner(user.getUserId()).setSince(since).setCloud(cloud).setRegion(zone).setFilterEndDate(filterEndDate).build();
return cloudbreakUsagesFacade.getUsagesFor(params);
}
use of com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder in project cloudbreak by hortonworks.
the class DefaultCloudbreakUsagesRetrievalHostServiceTypeTest method setUp.
@Before
public void setUp() {
underTest = new CloudbreakUsagesRetrievalService();
filterParameters = new Builder().setFilterEndDate(DUMMY_END_DATE).setAccount(DUMMY_ACCOUNT).setSince(DUMMY_SINCE).setOwner(DUMMY_OWNER).setRegion(DUMMY_REGION).setCloud(DUMMY_CLOUD).build();
usage = new CloudbreakUsage();
usage.setAccount(DUMMY_ACCOUNT);
MockitoAnnotations.initMocks(this);
}
Aggregations