com.softlayer.api.service.scale.Policy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of softlayer-api-client Show documentation
Show all versions of softlayer-api-client Show documentation
API client for accessing the SoftLayer API
package com.softlayer.api.service.scale;
import com.softlayer.api.ApiClient;
import com.softlayer.api.ResponseHandler;
import com.softlayer.api.annotation.ApiMethod;
import com.softlayer.api.annotation.ApiProperty;
import com.softlayer.api.annotation.ApiType;
import com.softlayer.api.service.Entity;
import com.softlayer.api.service.scale.Group;
import com.softlayer.api.service.scale.Member;
import com.softlayer.api.service.scale.policy.Action;
import com.softlayer.api.service.scale.policy.Trigger;
import com.softlayer.api.service.scale.policy.action.Scale;
import com.softlayer.api.service.scale.policy.trigger.OneTime;
import com.softlayer.api.service.scale.policy.trigger.Repeating;
import com.softlayer.api.service.scale.policy.trigger.ResourceUse;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.concurrent.Future;
/**
* A scale policy is a combination of triggers and actions that can occur on a scale group. When any trigger is satisfied (or the policy is manually triggered) the actions will be executed.
*
* @see SoftLayer_Scale_Policy
*/
@ApiType("SoftLayer_Scale_Policy")
public class Policy extends Entity {
/**
* The actions to perform upon any trigger hit. Currently this must be a single value.
*/
@ApiProperty
protected List actions;
public List getActions() {
if (actions == null) {
actions = new ArrayList();
}
return actions;
}
/**
* The one-time triggers to check for this group.
*/
@ApiProperty
protected List oneTimeTriggers;
public List getOneTimeTriggers() {
if (oneTimeTriggers == null) {
oneTimeTriggers = new ArrayList();
}
return oneTimeTriggers;
}
/**
* The repeating triggers to check for this group.
*/
@ApiProperty
protected List repeatingTriggers;
public List getRepeatingTriggers() {
if (repeatingTriggers == null) {
repeatingTriggers = new ArrayList();
}
return repeatingTriggers;
}
/**
* The resource-use triggers to check for this group.
*/
@ApiProperty
protected List resourceUseTriggers;
public List getResourceUseTriggers() {
if (resourceUseTriggers == null) {
resourceUseTriggers = new ArrayList();
}
return resourceUseTriggers;
}
/**
* The scale actions to perform upon any trigger hit. Currently this must be a single value.
*/
@ApiProperty
protected List scaleActions;
public List getScaleActions() {
if (scaleActions == null) {
scaleActions = new ArrayList();
}
return scaleActions;
}
/**
* The group this policy is on.
*/
@ApiProperty
protected Group scaleGroup;
public Group getScaleGroup() {
return scaleGroup;
}
public void setScaleGroup(Group scaleGroup) {
this.scaleGroup = scaleGroup;
}
/**
* The triggers to check for this group.
*/
@ApiProperty
protected List triggers;
public List getTriggers() {
if (triggers == null) {
triggers = new ArrayList();
}
return triggers;
}
/**
* The number of seconds this policy will wait after lastActionDate on group before performing another action. If not present, the group's cooldown value is used.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long cooldown;
public Long getCooldown() {
return cooldown;
}
public void setCooldown(Long cooldown) {
cooldownSpecified = true;
this.cooldown = cooldown;
}
protected boolean cooldownSpecified;
public boolean isCooldownSpecified() {
return cooldownSpecified;
}
public void unsetCooldown() {
cooldown = null;
cooldownSpecified = false;
}
/**
* When this policy was created.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected GregorianCalendar createDate;
public GregorianCalendar getCreateDate() {
return createDate;
}
public void setCreateDate(GregorianCalendar createDate) {
createDateSpecified = true;
this.createDate = createDate;
}
protected boolean createDateSpecified;
public boolean isCreateDateSpecified() {
return createDateSpecified;
}
public void unsetCreateDate() {
createDate = null;
createDateSpecified = false;
}
/**
* When set and true any edit that happens on this object, be it calling edit on this directly or setting as a child while editing a parent object, will end up being a deletion.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Boolean deleteFlag;
public Boolean getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Boolean deleteFlag) {
deleteFlagSpecified = true;
this.deleteFlag = deleteFlag;
}
protected boolean deleteFlagSpecified;
public boolean isDeleteFlagSpecified() {
return deleteFlagSpecified;
}
public void unsetDeleteFlag() {
deleteFlag = null;
deleteFlagSpecified = false;
}
/**
* A policy's internal identifier.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
idSpecified = true;
this.id = id;
}
protected boolean idSpecified;
public boolean isIdSpecified() {
return idSpecified;
}
public void unsetId() {
id = null;
idSpecified = false;
}
/**
* When this policy was last modified.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected GregorianCalendar modifyDate;
public GregorianCalendar getModifyDate() {
return modifyDate;
}
public void setModifyDate(GregorianCalendar modifyDate) {
modifyDateSpecified = true;
this.modifyDate = modifyDate;
}
protected boolean modifyDateSpecified;
public boolean isModifyDateSpecified() {
return modifyDateSpecified;
}
public void unsetModifyDate() {
modifyDate = null;
modifyDateSpecified = false;
}
/**
* The name of this policy. It must be unique within the group.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected String name;
public String getName() {
return name;
}
public void setName(String name) {
nameSpecified = true;
this.name = name;
}
protected boolean nameSpecified;
public boolean isNameSpecified() {
return nameSpecified;
}
public void unsetName() {
name = null;
nameSpecified = false;
}
/**
* The identifier of the group this member belongs to.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long scaleGroupId;
public Long getScaleGroupId() {
return scaleGroupId;
}
public void setScaleGroupId(Long scaleGroupId) {
scaleGroupIdSpecified = true;
this.scaleGroupId = scaleGroupId;
}
protected boolean scaleGroupIdSpecified;
public boolean isScaleGroupIdSpecified() {
return scaleGroupIdSpecified;
}
public void unsetScaleGroupId() {
scaleGroupId = null;
scaleGroupIdSpecified = false;
}
/**
* A count of the actions to perform upon any trigger hit. Currently this must be a single value.
*/
@ApiProperty
protected Long actionCount;
public Long getActionCount() {
return actionCount;
}
public void setActionCount(Long actionCount) {
this.actionCount = actionCount;
}
/**
* A count of the one-time triggers to check for this group.
*/
@ApiProperty
protected Long oneTimeTriggerCount;
public Long getOneTimeTriggerCount() {
return oneTimeTriggerCount;
}
public void setOneTimeTriggerCount(Long oneTimeTriggerCount) {
this.oneTimeTriggerCount = oneTimeTriggerCount;
}
/**
* A count of the repeating triggers to check for this group.
*/
@ApiProperty
protected Long repeatingTriggerCount;
public Long getRepeatingTriggerCount() {
return repeatingTriggerCount;
}
public void setRepeatingTriggerCount(Long repeatingTriggerCount) {
this.repeatingTriggerCount = repeatingTriggerCount;
}
/**
* A count of the resource-use triggers to check for this group.
*/
@ApiProperty
protected Long resourceUseTriggerCount;
public Long getResourceUseTriggerCount() {
return resourceUseTriggerCount;
}
public void setResourceUseTriggerCount(Long resourceUseTriggerCount) {
this.resourceUseTriggerCount = resourceUseTriggerCount;
}
/**
* A count of the scale actions to perform upon any trigger hit. Currently this must be a single value.
*/
@ApiProperty
protected Long scaleActionCount;
public Long getScaleActionCount() {
return scaleActionCount;
}
public void setScaleActionCount(Long scaleActionCount) {
this.scaleActionCount = scaleActionCount;
}
/**
* A count of the triggers to check for this group.
*/
@ApiProperty
protected Long triggerCount;
public Long getTriggerCount() {
return triggerCount;
}
public void setTriggerCount(Long triggerCount) {
this.triggerCount = triggerCount;
}
public Service asService(ApiClient client) {
return service(client, id);
}
public static Service service(ApiClient client) {
return client.createService(Service.class, null);
}
public static Service service(ApiClient client, Long id) {
return client.createService(Service.class, id == null ? null : id.toString());
}
/**
* A scale policy is a combination of triggers and actions that can occur on a scale group. When any trigger is satisfied (or the policy is manually triggered) the actions will be executed.
*
* @see SoftLayer_Scale_Policy
*/
@com.softlayer.api.annotation.ApiService("SoftLayer_Scale_Policy")
public static interface Service extends com.softlayer.api.Service {
public ServiceAsync asAsync();
public Mask withNewMask();
public Mask withMask();
public void setMask(Mask mask);
/**
* @see SoftLayer_Scale_Policy::createObject
*/
@ApiMethod
public Policy createObject(Policy templateObject);
/**
* @see SoftLayer_Scale_Policy::deleteObject
*/
@ApiMethod(instanceRequired = true)
public Boolean deleteObject();
/**
* @see SoftLayer_Scale_Policy::editObject
*/
@ApiMethod(instanceRequired = true)
public Boolean editObject(Policy templateObject);
/**
* @see SoftLayer_Scale_Policy::getObject
*/
@ApiMethod(instanceRequired = true)
public Policy getObject();
/**
* Manually trigger the actions on this policy. Returns members if the trigger has an effect, or an empty set of members if there is no effect. Sometimes this may not have an effect if the group is not active, in cooldown, or the result would violate the group range. If this call fails, the group is suspended, the failure logged, and a ticket is created.
*
* @see SoftLayer_Scale_Policy::trigger
*/
@ApiMethod(instanceRequired = true)
public List trigger();
/**
* The actions to perform upon any trigger hit. Currently this must be a single value.
*
* @see SoftLayer_Scale_Policy::getActions
*/
@ApiMethod(instanceRequired = true)
public List getActions();
/**
* The one-time triggers to check for this group.
*
* @see SoftLayer_Scale_Policy::getOneTimeTriggers
*/
@ApiMethod(instanceRequired = true)
public List getOneTimeTriggers();
/**
* The repeating triggers to check for this group.
*
* @see SoftLayer_Scale_Policy::getRepeatingTriggers
*/
@ApiMethod(instanceRequired = true)
public List getRepeatingTriggers();
/**
* The resource-use triggers to check for this group.
*
* @see SoftLayer_Scale_Policy::getResourceUseTriggers
*/
@ApiMethod(instanceRequired = true)
public List getResourceUseTriggers();
/**
* The scale actions to perform upon any trigger hit. Currently this must be a single value.
*
* @see SoftLayer_Scale_Policy::getScaleActions
*/
@ApiMethod(instanceRequired = true)
public List getScaleActions();
/**
* The group this policy is on.
*
* @see SoftLayer_Scale_Policy::getScaleGroup
*/
@ApiMethod(instanceRequired = true)
public Group getScaleGroup();
/**
* The triggers to check for this group.
*
* @see SoftLayer_Scale_Policy::getTriggers
*/
@ApiMethod(instanceRequired = true)
public List getTriggers();
}
public static interface ServiceAsync extends com.softlayer.api.ServiceAsync {
public Mask withNewMask();
public Mask withMask();
public void setMask(Mask mask);
/**
* Async version of {@link Service#createObject}
*/
public Future createObject(Policy templateObject);
public Future> createObject(Policy templateObject, ResponseHandler callback);
/**
* Async version of {@link Service#deleteObject}
*/
public Future deleteObject();
public Future> deleteObject(ResponseHandler callback);
/**
* Async version of {@link Service#editObject}
*/
public Future editObject(Policy templateObject);
public Future> editObject(Policy templateObject, ResponseHandler callback);
/**
* Async version of {@link Service#getObject}
*/
public Future getObject();
public Future> getObject(ResponseHandler callback);
/**
* Async version of {@link Service#trigger}
*/
public Future> trigger();
public Future> trigger(ResponseHandler> callback);
/**
* Async version of {@link Service#getActions}
*/
public Future> getActions();
/**
* Async callback version of {@link Service#getActions}
*/
public Future> getActions(ResponseHandler> callback);
/**
* Async version of {@link Service#getOneTimeTriggers}
*/
public Future> getOneTimeTriggers();
/**
* Async callback version of {@link Service#getOneTimeTriggers}
*/
public Future> getOneTimeTriggers(ResponseHandler> callback);
/**
* Async version of {@link Service#getRepeatingTriggers}
*/
public Future> getRepeatingTriggers();
/**
* Async callback version of {@link Service#getRepeatingTriggers}
*/
public Future> getRepeatingTriggers(ResponseHandler> callback);
/**
* Async version of {@link Service#getResourceUseTriggers}
*/
public Future> getResourceUseTriggers();
/**
* Async callback version of {@link Service#getResourceUseTriggers}
*/
public Future> getResourceUseTriggers(ResponseHandler> callback);
/**
* Async version of {@link Service#getScaleActions}
*/
public Future> getScaleActions();
/**
* Async callback version of {@link Service#getScaleActions}
*/
public Future> getScaleActions(ResponseHandler> callback);
/**
* Async version of {@link Service#getScaleGroup}
*/
public Future getScaleGroup();
/**
* Async callback version of {@link Service#getScaleGroup}
*/
public Future> getScaleGroup(ResponseHandler callback);
/**
* Async version of {@link Service#getTriggers}
*/
public Future> getTriggers();
/**
* Async callback version of {@link Service#getTriggers}
*/
public Future> getTriggers(ResponseHandler> callback);
}
public static class Mask extends com.softlayer.api.service.Entity.Mask {
public com.softlayer.api.service.scale.policy.Action.Mask actions() {
return withSubMask("actions", com.softlayer.api.service.scale.policy.Action.Mask.class);
}
public com.softlayer.api.service.scale.policy.trigger.OneTime.Mask oneTimeTriggers() {
return withSubMask("oneTimeTriggers", com.softlayer.api.service.scale.policy.trigger.OneTime.Mask.class);
}
public com.softlayer.api.service.scale.policy.trigger.Repeating.Mask repeatingTriggers() {
return withSubMask("repeatingTriggers", com.softlayer.api.service.scale.policy.trigger.Repeating.Mask.class);
}
public com.softlayer.api.service.scale.policy.trigger.ResourceUse.Mask resourceUseTriggers() {
return withSubMask("resourceUseTriggers", com.softlayer.api.service.scale.policy.trigger.ResourceUse.Mask.class);
}
public com.softlayer.api.service.scale.policy.action.Scale.Mask scaleActions() {
return withSubMask("scaleActions", com.softlayer.api.service.scale.policy.action.Scale.Mask.class);
}
public Group.Mask scaleGroup() {
return withSubMask("scaleGroup", Group.Mask.class);
}
public com.softlayer.api.service.scale.policy.Trigger.Mask triggers() {
return withSubMask("triggers", com.softlayer.api.service.scale.policy.Trigger.Mask.class);
}
public Mask cooldown() {
withLocalProperty("cooldown");
return this;
}
public Mask createDate() {
withLocalProperty("createDate");
return this;
}
public Mask deleteFlag() {
withLocalProperty("deleteFlag");
return this;
}
public Mask id() {
withLocalProperty("id");
return this;
}
public Mask modifyDate() {
withLocalProperty("modifyDate");
return this;
}
public Mask name() {
withLocalProperty("name");
return this;
}
public Mask scaleGroupId() {
withLocalProperty("scaleGroupId");
return this;
}
public Mask actionCount() {
withLocalProperty("actionCount");
return this;
}
public Mask oneTimeTriggerCount() {
withLocalProperty("oneTimeTriggerCount");
return this;
}
public Mask repeatingTriggerCount() {
withLocalProperty("repeatingTriggerCount");
return this;
}
public Mask resourceUseTriggerCount() {
withLocalProperty("resourceUseTriggerCount");
return this;
}
public Mask scaleActionCount() {
withLocalProperty("scaleActionCount");
return this;
}
public Mask triggerCount() {
withLocalProperty("triggerCount");
return this;
}
}
}