Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
release 1.0.24 code
Browse files Browse the repository at this point in the history
  • Loading branch information
wuchen-huawei committed Jul 14, 2020
1 parent a9bee4e commit 980a550
Show file tree
Hide file tree
Showing 25 changed files with 324 additions and 29 deletions.
2 changes: 1 addition & 1 deletion connectors/http-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.huawei.openstack4j.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<name>OpenStack4j HttpURL Connector</name>
<artifactId>openstack4j-http-connector</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei.openstack4j.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-httpclient</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/jersey2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei.openstack4j.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-jersey2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei.openstack4j.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-okhttp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.huawei.openstack4j.connectors</groupId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/resteasy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei.openstack4j.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-resteasy</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core-functional-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.huawei</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<artifactId>openstack4j-core-functional-test</artifactId>
<name>OpenStack4j Core Functional Test Cases</name>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-core-integration-test</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.huawei</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<artifactId>openstack-core-sample</artifactId>
<name>OpenStack4j Sample</name>
Expand Down
2 changes: 1 addition & 1 deletion core-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.huawei</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-core-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
import static org.testng.Assert.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;

import java.util.ArrayList;
import java.util.List;

import com.huawei.openstack4j.model.cloudeye.AlarmType;
import com.huawei.openstack4j.openstack.cloudeye.domain.*;
import org.testng.annotations.Test;

import com.huawei.openstack4j.api.AbstractTest;
Expand All @@ -30,7 +33,7 @@
import com.huawei.openstack4j.model.common.ActionResponse;
import com.huawei.openstack4j.openstack.cloudeye.internal.AlarmFilterOptions;

@Test(groups = "cloudeye", suiteName = "cloudeye/Alarms")
@Test(groups = "cloudeye", suiteName = "cloudeye/Alarms")
public class CloudEyeAlarmServiceTest extends AbstractTest {
private static final String JSON_ALARMS = "/cloudeye/list_alarms.json";
public static final String ALARM_ID = "al1483387711418ZNpR8DX3g";
Expand Down Expand Up @@ -88,5 +91,20 @@ public void deleteAlarmTest() throws Exception {
assertTrue(ptrRestoreActionResponse.isSuccess());
}

public void createAlarmTest() throws Exception {
CloudEyeMetricDemension dimension = new CloudEyeMetricDemension("instance_id", "1234567899_id");
List<CloudEyeMetricDemension> dimensions = new ArrayList<>();
dimensions.add(dimension);
CloudEyeMetric metric = new CloudEyeMetric("cpu_util", "%", "SYS.ECS", dimensions);
CloudEyeAlarmCondition condition = new CloudEyeAlarmCondition(300, "average", ">", 12, "%", 3);
CloudEyeAlarmAction action = new CloudEyeAlarmAction(AlarmType.NOTIFICATION, new ArrayList<String>());
List<CloudEyeAlarmAction> actions = new ArrayList<>();
actions.add(action);
CloudEyeCreateAlarmReq alarm = new CloudEyeCreateAlarmReq("alarm_test", "alarm_desc", metric, condition, actions, actions,
actions, true, false, 2);

ActionResponse ptrRestoreActionResponse = osv3().cloudEye().alarms().create(alarm);
assertTrue(ptrRestoreActionResponse.isSuccess());
}
}

2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.huawei</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>1.0.23</version>
<version>1.0.24</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@
import com.huawei.openstack4j.common.RestService;
import com.huawei.openstack4j.model.cloudeye.Alarm;
import com.huawei.openstack4j.model.common.ActionResponse;
import com.huawei.openstack4j.openstack.cloudeye.domain.CloudEyeCreateAlarmReq;
import com.huawei.openstack4j.openstack.cloudeye.internal.AlarmFilterOptions;

public interface AlarmService extends RestService {


/**
* @param alarm The alarm info for creating
* @return
*/
ActionResponse create(CloudEyeCreateAlarmReq alarm);

/**
* list alarm
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CloudEyeAlarmAction implements AlarmAction{
private static final long serialVersionUID = 5604518526573924452L;

AlarmType type;
List<String> notificationlist;

public CloudEyeAlarmAction(AlarmType type, List<String> notificationlist) {
this.type = type;
this.notificationlist = notificationlist;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CloudEyeAlarmCondition implements Condition {
private static final long serialVersionUID = 5719142668031530589L;
Expand All @@ -37,5 +36,14 @@ public class CloudEyeAlarmCondition implements Condition {
Number value;
String unit;
Integer count;

public CloudEyeAlarmCondition (Integer period, String filter, String comparisonOperator, Number value, String unit, Integer count) {
this.period = period;
this.filter = filter;
this.comparisonOperator = comparisonOperator;
this.value = value;
this.unit = unit;
this.count = count;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*******************************************************************************
* Copyright 2018 Huawei Technologies Co.,Ltd.
*
* Licensed 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 com.huawei.openstack4j.openstack.cloudeye.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.huawei.openstack4j.model.ModelEntity;
import lombok.*;

import java.util.List;

@Getter
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CloudEyeCreateAlarmReq implements ModelEntity {
private static final long serialVersionUID = -1524440551458098127L;

@JsonProperty("alarm_name")
String alarmName;

@JsonProperty("alarm_description")
String alarmDescription;

CloudEyeMetric metric;

CloudEyeAlarmCondition condition;

@JsonProperty("alarm_actions")
List<CloudEyeAlarmAction> alarmActions;

@JsonProperty("insufficientdata_actions")
List<CloudEyeAlarmAction> insufficientdataActions;

@JsonProperty("ok_actions")
List<CloudEyeAlarmAction> okActions;

@JsonProperty("alarm_enabled")
Boolean alarmEnabled;

@JsonProperty("alarm_action_enabled")
Boolean alarmActionEnabled;

@JsonProperty("alarm_level")
Integer alarmLevel;

public CloudEyeCreateAlarmReq (String alarmName, String alarmDescription, CloudEyeMetric metric, CloudEyeAlarmCondition condition, List<CloudEyeAlarmAction> alarmActions, List<CloudEyeAlarmAction> insufficientdataActions,
List<CloudEyeAlarmAction> okActions, Boolean alarmEnabled, Boolean alarmActionEnabled, Integer alarmLevel) {
this.alarmName = alarmName;
this.alarmDescription = alarmDescription;
this.metric = metric;
this.condition = condition;
this.alarmActions = alarmActions;
this.insufficientdataActions = insufficientdataActions;
this.okActions = okActions;
this.alarmActionEnabled = alarmActionEnabled;
this.alarmEnabled = alarmEnabled;
this.alarmLevel = alarmLevel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,11 @@ public List<CloudEyeMetric> value() {
return list;
}
}

public CloudEyeMetric(String metricName, String unit, String namespace, List<CloudEyeMetricDemension> dimensions) {
this.metricName = metricName;
this.unit = unit;
this.namespace = namespace;
this.dimensions = dimensions;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CloudEyeMetricDemension implements MetricDimensions {
private static final long serialVersionUID = -959253863059879414L;

String name;
String value;

public CloudEyeMetricDemension(String name, String value) {
this.name = name;
this.value = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@
import com.huawei.openstack4j.model.cloudeye.Alarm;
import com.huawei.openstack4j.model.common.ActionResponse;
import com.huawei.openstack4j.openstack.cloudeye.domain.CloudEyeAlarm;
import com.huawei.openstack4j.openstack.cloudeye.domain.CloudEyeCreateAlarmReq;

public class CloudEyeAlarmServiceImpl extends BaseCloudEyeServices implements AlarmService {
public class CloudEyeAlarmServiceImpl extends BaseCloudEyeServices implements AlarmService {

@Override
public ActionResponse create(CloudEyeCreateAlarmReq alarm) {
checkNotNull(alarm);
return postWithResponse(PATH_ALARMS).entity(alarm).execute();
}

@Override
public List<? extends Alarm> list() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.huawei.openstack4j.openstack.ecs.v1.contants;

public enum InterruptionPolicyEnum {
/**
* Enum IMMEDIATE for value: "immediate"
*/
immediate,
/**
* Enum DELAY for value: "delay"
*/
delay

}
Loading

0 comments on commit 980a550

Please sign in to comment.