Search in sources :

Example 1 with Builder

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);
}
Also used : CbUsageFilterParameters(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters) Builder(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder)

Example 2 with Builder

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);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) CbUsageFilterParameters(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters) Builder(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder)

Example 3 with Builder

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);
}
Also used : CbUsageFilterParameters(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters) Builder(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder)

Example 4 with Builder

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);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) CbUsageFilterParameters(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters) Builder(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder)

Example 5 with Builder

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);
}
Also used : Builder(com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder) CloudbreakUsage(com.sequenceiq.cloudbreak.domain.CloudbreakUsage) Before(org.junit.Before)

Aggregations

Builder (com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters.Builder)5 CbUsageFilterParameters (com.sequenceiq.cloudbreak.domain.CbUsageFilterParameters)4 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 CloudbreakUsage (com.sequenceiq.cloudbreak.domain.CloudbreakUsage)1 Before (org.junit.Before)1