-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Quota custom tariffs #5909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quota custom tariffs #5909
Changes from 25 commits
2eb091a
d20ed75
0231918
4cbc384
b95bd9a
16d6628
43b5139
6b2e595
7d4fd49
7f96b09
8650066
848ab59
5ea36bb
e914f4b
6b0bd9b
6e713a5
5c39945
270798c
0d72274
4dc7468
e3489ed
48af923
a74de9d
c0cdddc
d70634a
756a72b
c1a9254
ccecdcc
7acc271
e566f33
dcbaae3
35d9298
525b89c
2ed80b8
85a7267
84f2de3
06ab4f0
6b3395a
2b8a548
5c443de
5e31de4
6061c03
69776b7
e69c17a
dfcbd98
b0cb4d1
867fbe9
2e89687
5442aff
7376833
ef500cb
4664e0f
cb64ca4
0f9c537
fbb1afe
4b49556
1d3786d
cf1466a
aad60b2
24ead36
2d53c15
2d18abb
1e6eaf0
929c054
2e606ea
ef50b0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.apache.cloudstack.usage; | ||
|
|
||
| public enum UsageUnitTypes { | ||
| ComputeMonth ("Compute-Month"), | ||
| IpMonth ("IP-Month"), | ||
| Gb ("GB"), | ||
| GbMonth ("GB-Month"), | ||
| PolicyMonth ("Policy-Month"); | ||
|
|
||
| private final String description; | ||
|
|
||
| private UsageUnitTypes(String description) { | ||
| this.description = description; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return description; | ||
| } | ||
|
|
||
| /** | ||
| * Retrieves the UsageUnitTypes according to the parameter.<br/><br/> | ||
| * If there are no UsageUnitTypes with the description, it will try to retrieve it with {@link UsageUnitTypes#valueOf(String)} and will throw an | ||
| * {@link IllegalArgumentException} if it not exist. | ||
| */ | ||
| public static UsageUnitTypes getByDescription(String description) { | ||
| for (UsageUnitTypes type : UsageUnitTypes.values()) { | ||
| if (type.toString().equals(description)) { | ||
| return type; | ||
| } | ||
| } | ||
|
|
||
| return UsageUnitTypes.valueOf(description); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.apache.cloudstack.usage; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
| import org.junit.runner.RunWith; | ||
| import org.mockito.junit.MockitoJUnitRunner; | ||
|
|
||
| @RunWith(MockitoJUnitRunner.class) | ||
| public class UsageUnitTypesTest { | ||
|
|
||
| private List<UsageUnitTypes> usageUnitTypes = Arrays.asList(UsageUnitTypes.values()); | ||
|
|
||
| @Test | ||
| public void getByDescriptionTestAllTheDescriptionsMustReturnUsageUnitTypes() { | ||
| usageUnitTypes.forEach(type -> { | ||
| UsageUnitTypes usageUnitType = UsageUnitTypes.getByDescription(type.toString()); | ||
| Assert.assertEquals(type, usageUnitType); | ||
| }); | ||
| } | ||
|
|
||
| @Test | ||
| public void getByDescriptionTestAllTheConstantNamesMustReturnUsageUnitTypes() { | ||
| usageUnitTypes.forEach(type -> { | ||
| UsageUnitTypes usageUnitType = UsageUnitTypes.getByDescription(type.name()); | ||
| Assert.assertEquals(type, usageUnitType); | ||
| }); | ||
| } | ||
|
|
||
| @Test (expected = IllegalArgumentException.class) | ||
| public void getByDescriptionTestPassWrongTypeOrDescriptionAndThrowsIllegalArgumentException() { | ||
| UsageUnitTypes.getByDescription("test"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,16 @@ | |
|
|
||
| import java.util.List; | ||
|
|
||
| import org.apache.cloudstack.framework.config.ConfigKey; | ||
|
|
||
| import com.cloud.storage.Snapshot; | ||
| import com.cloud.utils.exception.CloudRuntimeException; | ||
|
|
||
| public interface SnapshotInfo extends DataObject, Snapshot { | ||
| ConfigKey<Boolean> BackupSnapshotAfterTakingSnapshot = new ConfigKey<Boolean>(Boolean.class, "snapshot.backup.to.secondary", "Snapshots", "true", "Indicates whether to always" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this should on a service - and not on a resource interface. I'd sugest
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DaanHoogland, it was in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm, reasonable explanation, it still doesn't feel good. I don't want to be dogmatic about it, but let's keep thinking about this. If we can't find a better way, soit. |
||
| + " backup primary storage snapshot to secondary storage. Keeping snapshots only on Primary storage is applicable for KVM + Ceph only.", false, ConfigKey.Scope.Global, | ||
| null); | ||
|
|
||
| SnapshotInfo getParent(); | ||
|
|
||
| String getPath(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.