com.softlayer.api.service.notification.user.Subscriber 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.notification.user;
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.Notification;
import com.softlayer.api.service.notification.Preference;
import com.softlayer.api.service.notification.delivery.Method;
import com.softlayer.api.service.notification.user.subscriber.Resource;
import com.softlayer.api.service.user.Customer;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
/**
* A notification subscriber will have details pertaining to the subscriber's notification subscription. You can receive details such as preferences, details of the preferences, delivery methods and the delivery methods for the subscriber.
*
* NOTE: There are preferences and delivery methods that cannot be modified. Also, there are some subscriptions that are required.
*
* @see SoftLayer_Notification_User_Subscriber
*/
@ApiType("SoftLayer_Notification_User_Subscriber")
public class Subscriber extends Entity {
/**
* The delivery methods used to send the subscribed notification.
*/
@ApiProperty
protected List deliveryMethods;
public List getDeliveryMethods() {
if (deliveryMethods == null) {
deliveryMethods = new ArrayList();
}
return deliveryMethods;
}
/**
* Notification subscribed to.
*/
@ApiProperty
protected Notification notification;
public Notification getNotification() {
return notification;
}
public void setNotification(Notification notification) {
this.notification = notification;
}
/**
* Associated subscriber preferences used for the notification subscription. For example, preferences include number of deliveries (limit) and threshold.
*/
@ApiProperty
protected List preferences;
public List getPreferences() {
if (preferences == null) {
preferences = new ArrayList();
}
return preferences;
}
/**
* Preference details such as description, minimum and maximum limits, default value and unit of measure.
*/
@ApiProperty
protected List preferencesDetails;
public List getPreferencesDetails() {
if (preferencesDetails == null) {
preferencesDetails = new ArrayList();
}
return preferencesDetails;
}
/**
* The subscriber id to resource id mapping.
*/
@ApiProperty
protected Resource resourceRecord;
public Resource getResourceRecord() {
return resourceRecord;
}
public void setResourceRecord(Resource resourceRecord) {
this.resourceRecord = resourceRecord;
}
/**
* User record for the subscription.
*/
@ApiProperty
protected Customer userRecord;
public Customer getUserRecord() {
return userRecord;
}
public void setUserRecord(Customer userRecord) {
this.userRecord = userRecord;
}
/**
* The current status of the subscription.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long active;
public Long getActive() {
return active;
}
public void setActive(Long active) {
activeSpecified = true;
this.active = active;
}
protected boolean activeSpecified;
public boolean isActiveSpecified() {
return activeSpecified;
}
public void unsetActive() {
active = null;
activeSpecified = false;
}
/**
* Unique identifier of the subscriber that will receive the alerts.
*/
@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;
}
/**
* Unique identifier of the notification subscribed to.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long notificationId;
public Long getNotificationId() {
return notificationId;
}
public void setNotificationId(Long notificationId) {
notificationIdSpecified = true;
this.notificationId = notificationId;
}
protected boolean notificationIdSpecified;
public boolean isNotificationIdSpecified() {
return notificationIdSpecified;
}
public void unsetNotificationId() {
notificationId = null;
notificationIdSpecified = false;
}
/**
* Unique identifier of the user the subscription is for.
*/
@ApiProperty(canBeNullOrNotSet = true)
protected Long userRecordId;
public Long getUserRecordId() {
return userRecordId;
}
public void setUserRecordId(Long userRecordId) {
userRecordIdSpecified = true;
this.userRecordId = userRecordId;
}
protected boolean userRecordIdSpecified;
public boolean isUserRecordIdSpecified() {
return userRecordIdSpecified;
}
public void unsetUserRecordId() {
userRecordId = null;
userRecordIdSpecified = false;
}
/**
* A count of the delivery methods used to send the subscribed notification.
*/
@ApiProperty
protected Long deliveryMethodCount;
public Long getDeliveryMethodCount() {
return deliveryMethodCount;
}
public void setDeliveryMethodCount(Long deliveryMethodCount) {
this.deliveryMethodCount = deliveryMethodCount;
}
/**
* A count of associated subscriber preferences used for the notification subscription. For example, preferences include number of deliveries (limit) and threshold.
*/
@ApiProperty
protected Long preferenceCount;
public Long getPreferenceCount() {
return preferenceCount;
}
public void setPreferenceCount(Long preferenceCount) {
this.preferenceCount = preferenceCount;
}
/**
* A count of preference details such as description, minimum and maximum limits, default value and unit of measure.
*/
@ApiProperty
protected Long preferencesDetailCount;
public Long getPreferencesDetailCount() {
return preferencesDetailCount;
}
public void setPreferencesDetailCount(Long preferencesDetailCount) {
this.preferencesDetailCount = preferencesDetailCount;
}
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());
}
/**
* SoftLayer Customers can subscribe to receive notifications for various notification types. This service also allows you to "turn on" or "turn off" notification messages sent to a subscriber for certain notifications.
*
* @see SoftLayer_Notification_User_Subscriber
*/
@com.softlayer.api.annotation.ApiService("SoftLayer_Notification_User_Subscriber")
public static interface Service extends com.softlayer.api.Service {
public ServiceAsync asAsync();
public Mask withNewMask();
public Mask withMask();
public void setMask(Mask mask);
/**
* Use the method to create a new subscription for a notification. This method is the entry method to the notification system. Certain properties are required to create a subscription while others are optional.
*
* The required property is the resourceRecord property which is type SoftLayer_Notification_User_Subscriber_Resource. For the resourceRecord property, the only property that needs to be populated is the resourceTableId. The resourceTableId is the unique identifier of a SoftLayer service to create the subscription for. For example, the unique identifier of the Storage Evault service to create the subscription on.
*
* Optional properties that can be set is the preferences property. The preference property is an array SoftLayer_Notification_User_Subscriber_Preference. By default, the system will populate the preferences with the default values if no preferences are passed in. The preferences passed in must be the preferences related to the notification subscribing to. The notification preferences and preference details (such as minimum and maximum values) can be retrieved using the SoftLayer_Notification service. The properties that need to be populated for preferences are the notificationPreferenceId and value.
*
* For example to create a subscriber for a Storage EVault service to be notified 15 times during a billing cycle and to be notified when the vault usage reaches 85% of its allowed capacity use the following structure:
*
*
* *userRecordId = 1111
* *notificationId = 3
* *resourceRecord
* **resourceTableId = 1234
* *preferences[1]
* **notificationPreferenceId = 2
* **value = 85
* *preference[2]
* **notificationPreferenceId = 3
* **value = 15
*
*
*
* @see SoftLayer_Notification_User_Subscriber::createObject
*/
@ApiMethod
public Boolean createObject(Subscriber templateObject);
/**
* The subscriber's subscription status can be "turned off" or "turned on" if the subscription is not required.
*
* Subscriber preferences may also be edited. To edit the preferences, you must pass in the id off the preferences to edit. Here is an example of structure to pass in. In this example, the structure will set the subscriber status to active and the threshold preference to 90 and the limit preference to 20
*
*
* *id = 1111
* *active = 1
* *preferences[1]
* **id = 11
* **value = 90
* *preference[2]
* **id = 12
* **value = 20
*
* @see SoftLayer_Notification_User_Subscriber::editObject
*/
@ApiMethod(instanceRequired = true)
public Boolean editObject(Subscriber templateObject);
/**
* @see SoftLayer_Notification_User_Subscriber::getObject
*/
@ApiMethod(instanceRequired = true)
public Subscriber getObject();
/**
* The delivery methods used to send the subscribed notification.
*
* @see SoftLayer_Notification_User_Subscriber::getDeliveryMethods
*/
@ApiMethod(instanceRequired = true)
public List getDeliveryMethods();
/**
* Notification subscribed to.
*
* @see SoftLayer_Notification_User_Subscriber::getNotification
*/
@ApiMethod(instanceRequired = true)
public Notification getNotification();
/**
* Associated subscriber preferences used for the notification subscription. For example, preferences include number of deliveries (limit) and threshold.
*
* @see SoftLayer_Notification_User_Subscriber::getPreferences
*/
@ApiMethod(instanceRequired = true)
public List getPreferences();
/**
* Preference details such as description, minimum and maximum limits, default value and unit of measure.
*
* @see SoftLayer_Notification_User_Subscriber::getPreferencesDetails
*/
@ApiMethod(instanceRequired = true)
public List getPreferencesDetails();
/**
* The subscriber id to resource id mapping.
*
* @see SoftLayer_Notification_User_Subscriber::getResourceRecord
*/
@ApiMethod(instanceRequired = true)
public Resource getResourceRecord();
/**
* User record for the subscription.
*
* @see SoftLayer_Notification_User_Subscriber::getUserRecord
*/
@ApiMethod(instanceRequired = true)
public Customer getUserRecord();
}
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(Subscriber templateObject);
public Future> createObject(Subscriber templateObject, ResponseHandler callback);
/**
* Async version of {@link Service#editObject}
*/
public Future editObject(Subscriber templateObject);
public Future> editObject(Subscriber templateObject, ResponseHandler callback);
/**
* Async version of {@link Service#getObject}
*/
public Future getObject();
public Future> getObject(ResponseHandler callback);
/**
* Async version of {@link Service#getDeliveryMethods}
*/
public Future> getDeliveryMethods();
/**
* Async callback version of {@link Service#getDeliveryMethods}
*/
public Future> getDeliveryMethods(ResponseHandler> callback);
/**
* Async version of {@link Service#getNotification}
*/
public Future getNotification();
/**
* Async callback version of {@link Service#getNotification}
*/
public Future> getNotification(ResponseHandler callback);
/**
* Async version of {@link Service#getPreferences}
*/
public Future> getPreferences();
/**
* Async callback version of {@link Service#getPreferences}
*/
public Future> getPreferences(ResponseHandler> callback);
/**
* Async version of {@link Service#getPreferencesDetails}
*/
public Future> getPreferencesDetails();
/**
* Async callback version of {@link Service#getPreferencesDetails}
*/
public Future> getPreferencesDetails(ResponseHandler> callback);
/**
* Async version of {@link Service#getResourceRecord}
*/
public Future getResourceRecord();
/**
* Async callback version of {@link Service#getResourceRecord}
*/
public Future> getResourceRecord(ResponseHandler callback);
/**
* Async version of {@link Service#getUserRecord}
*/
public Future getUserRecord();
/**
* Async callback version of {@link Service#getUserRecord}
*/
public Future> getUserRecord(ResponseHandler callback);
}
public static class Mask extends com.softlayer.api.service.Entity.Mask {
public com.softlayer.api.service.notification.delivery.Method.Mask deliveryMethods() {
return withSubMask("deliveryMethods", com.softlayer.api.service.notification.delivery.Method.Mask.class);
}
public com.softlayer.api.service.Notification.Mask notification() {
return withSubMask("notification", com.softlayer.api.service.Notification.Mask.class);
}
public com.softlayer.api.service.notification.user.subscriber.Preference.Mask preferences() {
return withSubMask("preferences", com.softlayer.api.service.notification.user.subscriber.Preference.Mask.class);
}
public com.softlayer.api.service.notification.Preference.Mask preferencesDetails() {
return withSubMask("preferencesDetails", com.softlayer.api.service.notification.Preference.Mask.class);
}
public com.softlayer.api.service.notification.user.subscriber.Resource.Mask resourceRecord() {
return withSubMask("resourceRecord", com.softlayer.api.service.notification.user.subscriber.Resource.Mask.class);
}
public com.softlayer.api.service.user.Customer.Mask userRecord() {
return withSubMask("userRecord", com.softlayer.api.service.user.Customer.Mask.class);
}
public Mask active() {
withLocalProperty("active");
return this;
}
public Mask id() {
withLocalProperty("id");
return this;
}
public Mask notificationId() {
withLocalProperty("notificationId");
return this;
}
public Mask userRecordId() {
withLocalProperty("userRecordId");
return this;
}
public Mask deliveryMethodCount() {
withLocalProperty("deliveryMethodCount");
return this;
}
public Mask preferenceCount() {
withLocalProperty("preferenceCount");
return this;
}
public Mask preferencesDetailCount() {
withLocalProperty("preferencesDetailCount");
return this;
}
}
}