1 /**
2 * Copyright 2016-2024 IBM Corp.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
8 * on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 * See the License for the specific language governing permissions and limitations under the License.
10 */
11 12 // AUTOMATICALLY GENERATED CODE - DO NOT MODIFY
13 14 package services
15 16 import (
17 "fmt"
18 "strings"
19 20 "github.com/softlayer/softlayer-go/datatypes"
21 "github.com/softlayer/softlayer-go/session"
22 "github.com/softlayer/softlayer-go/sl"
23 )
24 25 // Details provided for the notification are basic. Details such as the related preferences, name and keyname for the notification can be retrieved. The keyname property for the notification can be used to refer to a notification when integrating into the SoftLayer Notification system. The name property can used more for display purposes.
26 type Notification struct {
27 Session session.SLSession
28 Options sl.Options
29 }
30 31 // GetNotificationService returns an instance of the Notification SoftLayer service
32 func GetNotificationService(sess session.SLSession) Notification {
33 return Notification{Session: sess}
34 }
35 36 func (r Notification) Id(id int) Notification {
37 r.Options.Id = &id
38 return r
39 }
40 41 func (r Notification) Mask(mask string) Notification {
42 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
43 mask = fmt.Sprintf("mask[%s]", mask)
44 }
45 46 r.Options.Mask = mask
47 return r
48 }
49 50 func (r Notification) Filter(filter string) Notification {
51 r.Options.Filter = filter
52 return r
53 }
54 55 func (r Notification) Limit(limit int) Notification {
56 r.Options.Limit = &limit
57 return r
58 }
59 60 func (r Notification) Offset(offset int) Notification {
61 r.Options.Offset = &offset
62 return r
63 }
64 65 // Use this method to retrieve all active notifications that can be subscribed to.
66 func (r Notification) GetAllObjects() (resp []datatypes.Notification, err error) {
67 err = r.Session.DoRequest("SoftLayer_Notification", "getAllObjects", nil, &r.Options, &resp)
68 return
69 }
70 71 // no documentation yet
72 func (r Notification) GetObject() (resp datatypes.Notification, err error) {
73 err = r.Session.DoRequest("SoftLayer_Notification", "getObject", nil, &r.Options, &resp)
74 return
75 }
76 77 // Retrieve The preferences related to the notification. These are preferences are configurable and optional for subscribers to use.
78 func (r Notification) GetPreferences() (resp []datatypes.Notification_Preference, err error) {
79 err = r.Session.DoRequest("SoftLayer_Notification", "getPreferences", nil, &r.Options, &resp)
80 return
81 }
82 83 // Retrieve The required preferences related to the notification. While configurable, the subscriber does not have the option whether to use the preference.
84 func (r Notification) GetRequiredPreferences() (resp []datatypes.Notification_Preference, err error) {
85 err = r.Session.DoRequest("SoftLayer_Notification", "getRequiredPreferences", nil, &r.Options, &resp)
86 return
87 }
88 89 // This is an extension of the SoftLayer_Notification class. These are implementation details specific to those notifications which can be subscribed to and received on a mobile device.
90 type Notification_Mobile struct {
91 Session session.SLSession
92 Options sl.Options
93 }
94 95 // GetNotificationMobileService returns an instance of the Notification_Mobile SoftLayer service
96 func GetNotificationMobileService(sess session.SLSession) Notification_Mobile {
97 return Notification_Mobile{Session: sess}
98 }
99 100 func (r Notification_Mobile) Id(id int) Notification_Mobile {
101 r.Options.Id = &id
102 return r
103 }
104 105 func (r Notification_Mobile) Mask(mask string) Notification_Mobile {
106 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
107 mask = fmt.Sprintf("mask[%s]", mask)
108 }
109 110 r.Options.Mask = mask
111 return r
112 }
113 114 func (r Notification_Mobile) Filter(filter string) Notification_Mobile {
115 r.Options.Filter = filter
116 return r
117 }
118 119 func (r Notification_Mobile) Limit(limit int) Notification_Mobile {
120 r.Options.Limit = &limit
121 return r
122 }
123 124 func (r Notification_Mobile) Offset(offset int) Notification_Mobile {
125 r.Options.Offset = &offset
126 return r
127 }
128 129 // Create a new subscriber for a given resource.
130 func (r Notification_Mobile) CreateSubscriberForMobileDevice(keyName *string, resourceTableId *int, userRecordId *int) (resp bool, err error) {
131 params := []interface{}{
132 keyName,
133 resourceTableId,
134 userRecordId,
135 }
136 err = r.Session.DoRequest("SoftLayer_Notification_Mobile", "createSubscriberForMobileDevice", params, &r.Options, &resp)
137 return
138 }
139 140 // Use this method to retrieve all active notifications that can be subscribed to.
141 func (r Notification_Mobile) GetAllObjects() (resp []datatypes.Notification, err error) {
142 err = r.Session.DoRequest("SoftLayer_Notification_Mobile", "getAllObjects", nil, &r.Options, &resp)
143 return
144 }
145 146 // no documentation yet
147 func (r Notification_Mobile) GetObject() (resp datatypes.Notification_Mobile, err error) {
148 err = r.Session.DoRequest("SoftLayer_Notification_Mobile", "getObject", nil, &r.Options, &resp)
149 return
150 }
151 152 // Retrieve The preferences related to the notification. These are preferences are configurable and optional for subscribers to use.
153 func (r Notification_Mobile) GetPreferences() (resp []datatypes.Notification_Preference, err error) {
154 err = r.Session.DoRequest("SoftLayer_Notification_Mobile", "getPreferences", nil, &r.Options, &resp)
155 return
156 }
157 158 // Retrieve The required preferences related to the notification. While configurable, the subscriber does not have the option whether to use the preference.
159 func (r Notification_Mobile) GetRequiredPreferences() (resp []datatypes.Notification_Preference, err error) {
160 err = r.Session.DoRequest("SoftLayer_Notification_Mobile", "getRequiredPreferences", nil, &r.Options, &resp)
161 return
162 }
163 164 // no documentation yet
165 type Notification_Occurrence_Event struct {
166 Session session.SLSession
167 Options sl.Options
168 }
169 170 // GetNotificationOccurrenceEventService returns an instance of the Notification_Occurrence_Event SoftLayer service
171 func GetNotificationOccurrenceEventService(sess session.SLSession) Notification_Occurrence_Event {
172 return Notification_Occurrence_Event{Session: sess}
173 }
174 175 func (r Notification_Occurrence_Event) Id(id int) Notification_Occurrence_Event {
176 r.Options.Id = &id
177 return r
178 }
179 180 func (r Notification_Occurrence_Event) Mask(mask string) Notification_Occurrence_Event {
181 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
182 mask = fmt.Sprintf("mask[%s]", mask)
183 }
184 185 r.Options.Mask = mask
186 return r
187 }
188 189 func (r Notification_Occurrence_Event) Filter(filter string) Notification_Occurrence_Event {
190 r.Options.Filter = filter
191 return r
192 }
193 194 func (r Notification_Occurrence_Event) Limit(limit int) Notification_Occurrence_Event {
195 r.Options.Limit = &limit
196 return r
197 }
198 199 func (r Notification_Occurrence_Event) Offset(offset int) Notification_Occurrence_Event {
200 r.Options.Offset = &offset
201 return r
202 }
203 204 // <<<< EOT
205 func (r Notification_Occurrence_Event) AcknowledgeNotification() (resp bool, err error) {
206 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "acknowledgeNotification", nil, &r.Options, &resp)
207 return
208 }
209 210 // Retrieve Indicates whether or not this event has been acknowledged by the user.
211 func (r Notification_Occurrence_Event) GetAcknowledgedFlag() (resp bool, err error) {
212 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getAcknowledgedFlag", nil, &r.Options, &resp)
213 return
214 }
215 216 // no documentation yet
217 func (r Notification_Occurrence_Event) GetAllObjects() (resp []datatypes.Notification_Occurrence_Event, err error) {
218 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getAllObjects", nil, &r.Options, &resp)
219 return
220 }
221 222 // Retrieve the contents of the file attached to a SoftLayer event by it's given identifier.
223 func (r Notification_Occurrence_Event) GetAttachedFile(attachmentId *int) (resp []byte, err error) {
224 params := []interface{}{
225 attachmentId,
226 }
227 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getAttachedFile", params, &r.Options, &resp)
228 return
229 }
230 231 // Retrieve A collection of attachments for this event which provide supplementary information to impacted users some examples are RFO (Reason For Outage) and root cause analysis documents.
232 func (r Notification_Occurrence_Event) GetAttachments() (resp []datatypes.Notification_Occurrence_Event_Attachment, err error) {
233 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getAttachments", nil, &r.Options, &resp)
234 return
235 }
236 237 // Retrieve The first update for this event.
238 func (r Notification_Occurrence_Event) GetFirstUpdate() (resp datatypes.Notification_Occurrence_Update, err error) {
239 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getFirstUpdate", nil, &r.Options, &resp)
240 return
241 }
242 243 // This method will return the number of impacted owned accounts associated with this event for the current user.
244 func (r Notification_Occurrence_Event) GetImpactedAccountCount() (resp int, err error) {
245 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getImpactedAccountCount", nil, &r.Options, &resp)
246 return
247 }
248 249 // Retrieve A collection of accounts impacted by this event. Each impacted account record relates directly to a [[SoftLayer_Account]].
250 func (r Notification_Occurrence_Event) GetImpactedAccounts() (resp []datatypes.Notification_Occurrence_Account, err error) {
251 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getImpactedAccounts", nil, &r.Options, &resp)
252 return
253 }
254 255 // This method will return the number of impacted devices associated with this event for the current user.
256 func (r Notification_Occurrence_Event) GetImpactedDeviceCount() (resp int, err error) {
257 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getImpactedDeviceCount", nil, &r.Options, &resp)
258 return
259 }
260 261 // This method will return a collection of SoftLayer_Notification_Occurrence_Resource objects which is a listing of the current users' impacted devices that are associated with this event.
262 func (r Notification_Occurrence_Event) GetImpactedDevices() (resp []datatypes.Notification_Occurrence_Resource, err error) {
263 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getImpactedDevices", nil, &r.Options, &resp)
264 return
265 }
266 267 // Retrieve A collection of resources impacted by this event. Each record will relate to some physical resource that the user has access to such as [[SoftLayer_Hardware]] or [[SoftLayer_Virtual_Guest]].
268 func (r Notification_Occurrence_Event) GetImpactedResources() (resp []datatypes.Notification_Occurrence_Resource, err error) {
269 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getImpactedResources", nil, &r.Options, &resp)
270 return
271 }
272 273 // Retrieve A collection of users impacted by this event. Each impacted user record relates directly to a [[SoftLayer_User_Customer]].
274 func (r Notification_Occurrence_Event) GetImpactedUsers() (resp []datatypes.Notification_Occurrence_User, err error) {
275 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getImpactedUsers", nil, &r.Options, &resp)
276 return
277 }
278 279 // Retrieve The last update for this event.
280 func (r Notification_Occurrence_Event) GetLastUpdate() (resp datatypes.Notification_Occurrence_Update, err error) {
281 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getLastUpdate", nil, &r.Options, &resp)
282 return
283 }
284 285 // Retrieve The type of event such as planned or unplanned maintenance.
286 func (r Notification_Occurrence_Event) GetNotificationOccurrenceEventType() (resp datatypes.Notification_Occurrence_Event_Type, err error) {
287 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getNotificationOccurrenceEventType", nil, &r.Options, &resp)
288 return
289 }
290 291 // no documentation yet
292 func (r Notification_Occurrence_Event) GetObject() (resp datatypes.Notification_Occurrence_Event, err error) {
293 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getObject", nil, &r.Options, &resp)
294 return
295 }
296 297 // Retrieve
298 func (r Notification_Occurrence_Event) GetStatusCode() (resp datatypes.Notification_Occurrence_Status_Code, err error) {
299 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getStatusCode", nil, &r.Options, &resp)
300 return
301 }
302 303 // Retrieve All updates for this event.
304 func (r Notification_Occurrence_Event) GetUpdates() (resp []datatypes.Notification_Occurrence_Update, err error) {
305 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_Event", "getUpdates", nil, &r.Options, &resp)
306 return
307 }
308 309 // This type contains general information relating to a user that may be impacted by a [[SoftLayer_Notification_Occurrence_Event]].
310 type Notification_Occurrence_User struct {
311 Session session.SLSession
312 Options sl.Options
313 }
314 315 // GetNotificationOccurrenceUserService returns an instance of the Notification_Occurrence_User SoftLayer service
316 func GetNotificationOccurrenceUserService(sess session.SLSession) Notification_Occurrence_User {
317 return Notification_Occurrence_User{Session: sess}
318 }
319 320 func (r Notification_Occurrence_User) Id(id int) Notification_Occurrence_User {
321 r.Options.Id = &id
322 return r
323 }
324 325 func (r Notification_Occurrence_User) Mask(mask string) Notification_Occurrence_User {
326 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
327 mask = fmt.Sprintf("mask[%s]", mask)
328 }
329 330 r.Options.Mask = mask
331 return r
332 }
333 334 func (r Notification_Occurrence_User) Filter(filter string) Notification_Occurrence_User {
335 r.Options.Filter = filter
336 return r
337 }
338 339 func (r Notification_Occurrence_User) Limit(limit int) Notification_Occurrence_User {
340 r.Options.Limit = &limit
341 return r
342 }
343 344 func (r Notification_Occurrence_User) Offset(offset int) Notification_Occurrence_User {
345 r.Options.Offset = &offset
346 return r
347 }
348 349 // no documentation yet
350 func (r Notification_Occurrence_User) Acknowledge() (resp bool, err error) {
351 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "acknowledge", nil, &r.Options, &resp)
352 return
353 }
354 355 // no documentation yet
356 func (r Notification_Occurrence_User) GetAllObjects() (resp []datatypes.Notification_Occurrence_User, err error) {
357 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "getAllObjects", nil, &r.Options, &resp)
358 return
359 }
360 361 // no documentation yet
362 func (r Notification_Occurrence_User) GetImpactedDeviceCount() (resp int, err error) {
363 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "getImpactedDeviceCount", nil, &r.Options, &resp)
364 return
365 }
366 367 // Retrieve A collection of resources impacted by the associated event.
368 func (r Notification_Occurrence_User) GetImpactedResources() (resp []datatypes.Notification_Occurrence_Resource, err error) {
369 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "getImpactedResources", nil, &r.Options, &resp)
370 return
371 }
372 373 // Retrieve The associated event.
374 func (r Notification_Occurrence_User) GetNotificationOccurrenceEvent() (resp datatypes.Notification_Occurrence_Event, err error) {
375 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "getNotificationOccurrenceEvent", nil, &r.Options, &resp)
376 return
377 }
378 379 // no documentation yet
380 func (r Notification_Occurrence_User) GetObject() (resp datatypes.Notification_Occurrence_User, err error) {
381 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "getObject", nil, &r.Options, &resp)
382 return
383 }
384 385 // Retrieve The impacted user.
386 func (r Notification_Occurrence_User) GetUser() (resp datatypes.User_Customer, err error) {
387 err = r.Session.DoRequest("SoftLayer_Notification_Occurrence_User", "getUser", nil, &r.Options, &resp)
388 return
389 }
390 391 // 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.
392 //
393 // NOTE: There are preferences and delivery methods that cannot be modified. Also, there are some subscriptions that are required.
394 type Notification_User_Subscriber struct {
395 Session session.SLSession
396 Options sl.Options
397 }
398 399 // GetNotificationUserSubscriberService returns an instance of the Notification_User_Subscriber SoftLayer service
400 func GetNotificationUserSubscriberService(sess session.SLSession) Notification_User_Subscriber {
401 return Notification_User_Subscriber{Session: sess}
402 }
403 404 func (r Notification_User_Subscriber) Id(id int) Notification_User_Subscriber {
405 r.Options.Id = &id
406 return r
407 }
408 409 func (r Notification_User_Subscriber) Mask(mask string) Notification_User_Subscriber {
410 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
411 mask = fmt.Sprintf("mask[%s]", mask)
412 }
413 414 r.Options.Mask = mask
415 return r
416 }
417 418 func (r Notification_User_Subscriber) Filter(filter string) Notification_User_Subscriber {
419 r.Options.Filter = filter
420 return r
421 }
422 423 func (r Notification_User_Subscriber) Limit(limit int) Notification_User_Subscriber {
424 r.Options.Limit = &limit
425 return r
426 }
427 428 func (r Notification_User_Subscriber) Offset(offset int) Notification_User_Subscriber {
429 r.Options.Offset = &offset
430 return r
431 }
432 433 // 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.
434 //
435 // 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.
436 //
437 // 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.
438 //
439 // 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:
440 //
441 // *userRecordId = 1111
442 // *notificationId = 3
443 // *resourceRecord
444 // **resourceTableId = 1234
445 // *preferences[1]
446 // **notificationPreferenceId = 2
447 // **value = 85
448 // *preference[2]
449 // **notificationPreferenceId = 3
450 // **value = 15
451 func (r Notification_User_Subscriber) CreateObject(templateObject *datatypes.Notification_User_Subscriber) (resp bool, err error) {
452 params := []interface{}{
453 templateObject,
454 }
455 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "createObject", params, &r.Options, &resp)
456 return
457 }
458 459 // The subscriber's subscription status can be "turned off" or "turned on" if the subscription is not required.
460 //
461 // 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
462 //
463 // *id = 1111
464 // *active = 1
465 // *preferences[1]
466 // **id = 11
467 // **value = 90
468 // *preference[2]
469 // **id = 12
470 // **value = 20
471 func (r Notification_User_Subscriber) EditObject(templateObject *datatypes.Notification_User_Subscriber) (resp bool, err error) {
472 params := []interface{}{
473 templateObject,
474 }
475 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "editObject", params, &r.Options, &resp)
476 return
477 }
478 479 // Retrieve The delivery methods used to send the subscribed notification.
480 func (r Notification_User_Subscriber) GetDeliveryMethods() (resp []datatypes.Notification_Delivery_Method, err error) {
481 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getDeliveryMethods", nil, &r.Options, &resp)
482 return
483 }
484 485 // Retrieve Notification subscribed to.
486 func (r Notification_User_Subscriber) GetNotification() (resp datatypes.Notification, err error) {
487 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getNotification", nil, &r.Options, &resp)
488 return
489 }
490 491 // no documentation yet
492 func (r Notification_User_Subscriber) GetObject() (resp datatypes.Notification_User_Subscriber, err error) {
493 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getObject", nil, &r.Options, &resp)
494 return
495 }
496 497 // Retrieve Associated subscriber preferences used for the notification subscription. For example, preferences include number of deliveries (limit) and threshold.
498 func (r Notification_User_Subscriber) GetPreferences() (resp []datatypes.Notification_User_Subscriber_Preference, err error) {
499 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getPreferences", nil, &r.Options, &resp)
500 return
501 }
502 503 // Retrieve Preference details such as description, minimum and maximum limits, default value and unit of measure.
504 func (r Notification_User_Subscriber) GetPreferencesDetails() (resp []datatypes.Notification_Preference, err error) {
505 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getPreferencesDetails", nil, &r.Options, &resp)
506 return
507 }
508 509 // Retrieve The subscriber id to resource id mapping.
510 func (r Notification_User_Subscriber) GetResourceRecord() (resp datatypes.Notification_User_Subscriber_Resource, err error) {
511 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getResourceRecord", nil, &r.Options, &resp)
512 return
513 }
514 515 // Retrieve User record for the subscription.
516 func (r Notification_User_Subscriber) GetUserRecord() (resp datatypes.User_Customer, err error) {
517 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber", "getUserRecord", nil, &r.Options, &resp)
518 return
519 }
520 521 // 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.
522 //
523 // NOTE: There are preferences and delivery methods that cannot be modified. Also, there are some subscriptions that are required.
524 type Notification_User_Subscriber_Billing struct {
525 Session session.SLSession
526 Options sl.Options
527 }
528 529 // GetNotificationUserSubscriberBillingService returns an instance of the Notification_User_Subscriber_Billing SoftLayer service
530 func GetNotificationUserSubscriberBillingService(sess session.SLSession) Notification_User_Subscriber_Billing {
531 return Notification_User_Subscriber_Billing{Session: sess}
532 }
533 534 func (r Notification_User_Subscriber_Billing) Id(id int) Notification_User_Subscriber_Billing {
535 r.Options.Id = &id
536 return r
537 }
538 539 func (r Notification_User_Subscriber_Billing) Mask(mask string) Notification_User_Subscriber_Billing {
540 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
541 mask = fmt.Sprintf("mask[%s]", mask)
542 }
543 544 r.Options.Mask = mask
545 return r
546 }
547 548 func (r Notification_User_Subscriber_Billing) Filter(filter string) Notification_User_Subscriber_Billing {
549 r.Options.Filter = filter
550 return r
551 }
552 553 func (r Notification_User_Subscriber_Billing) Limit(limit int) Notification_User_Subscriber_Billing {
554 r.Options.Limit = &limit
555 return r
556 }
557 558 func (r Notification_User_Subscriber_Billing) Offset(offset int) Notification_User_Subscriber_Billing {
559 r.Options.Offset = &offset
560 return r
561 }
562 563 // 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.
564 //
565 // 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.
566 //
567 // 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.
568 //
569 // 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:
570 //
571 // *userRecordId = 1111
572 // *notificationId = 3
573 // *resourceRecord
574 // **resourceTableId = 1234
575 // *preferences[1]
576 // **notificationPreferenceId = 2
577 // **value = 85
578 // *preference[2]
579 // **notificationPreferenceId = 3
580 // **value = 15
581 func (r Notification_User_Subscriber_Billing) CreateObject(templateObject *datatypes.Notification_User_Subscriber) (resp bool, err error) {
582 params := []interface{}{
583 templateObject,
584 }
585 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "createObject", params, &r.Options, &resp)
586 return
587 }
588 589 // The subscriber's subscription status can be "turned off" or "turned on" if the subscription is not required.
590 //
591 // 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
592 //
593 // *id = 1111
594 // *active = 1
595 // *preferences[1]
596 // **id = 11
597 // **value = 90
598 // *preference[2]
599 // **id = 12
600 // **value = 20
601 func (r Notification_User_Subscriber_Billing) EditObject(templateObject *datatypes.Notification_User_Subscriber) (resp bool, err error) {
602 params := []interface{}{
603 templateObject,
604 }
605 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "editObject", params, &r.Options, &resp)
606 return
607 }
608 609 // Retrieve The delivery methods used to send the subscribed notification.
610 func (r Notification_User_Subscriber_Billing) GetDeliveryMethods() (resp []datatypes.Notification_Delivery_Method, err error) {
611 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getDeliveryMethods", nil, &r.Options, &resp)
612 return
613 }
614 615 // Retrieve Notification subscribed to.
616 func (r Notification_User_Subscriber_Billing) GetNotification() (resp datatypes.Notification, err error) {
617 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getNotification", nil, &r.Options, &resp)
618 return
619 }
620 621 // no documentation yet
622 func (r Notification_User_Subscriber_Billing) GetObject() (resp datatypes.Notification_User_Subscriber_Billing, err error) {
623 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getObject", nil, &r.Options, &resp)
624 return
625 }
626 627 // Retrieve Associated subscriber preferences used for the notification subscription. For example, preferences include number of deliveries (limit) and threshold.
628 func (r Notification_User_Subscriber_Billing) GetPreferences() (resp []datatypes.Notification_User_Subscriber_Preference, err error) {
629 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getPreferences", nil, &r.Options, &resp)
630 return
631 }
632 633 // Retrieve Preference details such as description, minimum and maximum limits, default value and unit of measure.
634 func (r Notification_User_Subscriber_Billing) GetPreferencesDetails() (resp []datatypes.Notification_Preference, err error) {
635 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getPreferencesDetails", nil, &r.Options, &resp)
636 return
637 }
638 639 // Retrieve The subscriber id to resource id mapping.
640 func (r Notification_User_Subscriber_Billing) GetResourceRecord() (resp datatypes.Notification_User_Subscriber_Resource, err error) {
641 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getResourceRecord", nil, &r.Options, &resp)
642 return
643 }
644 645 // Retrieve User record for the subscription.
646 func (r Notification_User_Subscriber_Billing) GetUserRecord() (resp datatypes.User_Customer, err error) {
647 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Billing", "getUserRecord", nil, &r.Options, &resp)
648 return
649 }
650 651 // 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.
652 //
653 // NOTE: There are preferences and delivery methods that cannot be modified. Also, there are some subscriptions that are required.
654 type Notification_User_Subscriber_Mobile struct {
655 Session session.SLSession
656 Options sl.Options
657 }
658 659 // GetNotificationUserSubscriberMobileService returns an instance of the Notification_User_Subscriber_Mobile SoftLayer service
660 func GetNotificationUserSubscriberMobileService(sess session.SLSession) Notification_User_Subscriber_Mobile {
661 return Notification_User_Subscriber_Mobile{Session: sess}
662 }
663 664 func (r Notification_User_Subscriber_Mobile) Id(id int) Notification_User_Subscriber_Mobile {
665 r.Options.Id = &id
666 return r
667 }
668 669 func (r Notification_User_Subscriber_Mobile) Mask(mask string) Notification_User_Subscriber_Mobile {
670 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
671 mask = fmt.Sprintf("mask[%s]", mask)
672 }
673 674 r.Options.Mask = mask
675 return r
676 }
677 678 func (r Notification_User_Subscriber_Mobile) Filter(filter string) Notification_User_Subscriber_Mobile {
679 r.Options.Filter = filter
680 return r
681 }
682 683 func (r Notification_User_Subscriber_Mobile) Limit(limit int) Notification_User_Subscriber_Mobile {
684 r.Options.Limit = &limit
685 return r
686 }
687 688 func (r Notification_User_Subscriber_Mobile) Offset(offset int) Notification_User_Subscriber_Mobile {
689 r.Options.Offset = &offset
690 return r
691 }
692 693 // no documentation yet
694 func (r Notification_User_Subscriber_Mobile) ClearSnoozeTimer() (resp bool, err error) {
695 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "clearSnoozeTimer", nil, &r.Options, &resp)
696 return
697 }
698 699 // 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.
700 //
701 // 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.
702 //
703 // 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.
704 //
705 // 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:
706 //
707 // *userRecordId = 1111
708 // *notificationId = 3
709 // *resourceRecord
710 // **resourceTableId = 1234
711 // *preferences[1]
712 // **notificationPreferenceId = 2
713 // **value = 85
714 // *preference[2]
715 // **notificationPreferenceId = 3
716 // **value = 15
717 func (r Notification_User_Subscriber_Mobile) CreateObject(templateObject *datatypes.Notification_User_Subscriber) (resp bool, err error) {
718 params := []interface{}{
719 templateObject,
720 }
721 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "createObject", params, &r.Options, &resp)
722 return
723 }
724 725 // The subscriber's subscription status can be "turned off" or "turned on" if the subscription is not required.
726 //
727 // 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
728 //
729 // *id = 1111
730 // *active = 1
731 // *preferences[1]
732 // **id = 11
733 // **value = 90
734 // *preference[2]
735 // **id = 12
736 // **value = 20
737 func (r Notification_User_Subscriber_Mobile) EditObject(templateObject *datatypes.Notification_User_Subscriber) (resp bool, err error) {
738 params := []interface{}{
739 templateObject,
740 }
741 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "editObject", params, &r.Options, &resp)
742 return
743 }
744 745 // Retrieve The delivery methods used to send the subscribed notification.
746 func (r Notification_User_Subscriber_Mobile) GetDeliveryMethods() (resp []datatypes.Notification_Delivery_Method, err error) {
747 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getDeliveryMethods", nil, &r.Options, &resp)
748 return
749 }
750 751 // Retrieve Notification subscribed to.
752 func (r Notification_User_Subscriber_Mobile) GetNotification() (resp datatypes.Notification, err error) {
753 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getNotification", nil, &r.Options, &resp)
754 return
755 }
756 757 // no documentation yet
758 func (r Notification_User_Subscriber_Mobile) GetObject() (resp datatypes.Notification_User_Subscriber_Mobile, err error) {
759 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getObject", nil, &r.Options, &resp)
760 return
761 }
762 763 // Retrieve Associated subscriber preferences used for the notification subscription. For example, preferences include number of deliveries (limit) and threshold.
764 func (r Notification_User_Subscriber_Mobile) GetPreferences() (resp []datatypes.Notification_User_Subscriber_Preference, err error) {
765 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getPreferences", nil, &r.Options, &resp)
766 return
767 }
768 769 // Retrieve Preference details such as description, minimum and maximum limits, default value and unit of measure.
770 func (r Notification_User_Subscriber_Mobile) GetPreferencesDetails() (resp []datatypes.Notification_Preference, err error) {
771 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getPreferencesDetails", nil, &r.Options, &resp)
772 return
773 }
774 775 // Retrieve The subscriber id to resource id mapping.
776 func (r Notification_User_Subscriber_Mobile) GetResourceRecord() (resp datatypes.Notification_User_Subscriber_Resource, err error) {
777 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getResourceRecord", nil, &r.Options, &resp)
778 return
779 }
780 781 // Retrieve User record for the subscription.
782 func (r Notification_User_Subscriber_Mobile) GetUserRecord() (resp datatypes.User_Customer, err error) {
783 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "getUserRecord", nil, &r.Options, &resp)
784 return
785 }
786 787 // no documentation yet
788 func (r Notification_User_Subscriber_Mobile) SetSnoozeTimer(start *int, end *int) (resp bool, err error) {
789 params := []interface{}{
790 start,
791 end,
792 }
793 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Mobile", "setSnoozeTimer", params, &r.Options, &resp)
794 return
795 }
796 797 // Preferences are settings that can be modified to change the behavior of the subscription. For example, modify the limit preference to only receive notifications 10 times instead of 1 during a billing cycle.
798 //
799 // NOTE: Some preferences have certain restrictions on values that can be set.
800 type Notification_User_Subscriber_Preference struct {
801 Session session.SLSession
802 Options sl.Options
803 }
804 805 // GetNotificationUserSubscriberPreferenceService returns an instance of the Notification_User_Subscriber_Preference SoftLayer service
806 func GetNotificationUserSubscriberPreferenceService(sess session.SLSession) Notification_User_Subscriber_Preference {
807 return Notification_User_Subscriber_Preference{Session: sess}
808 }
809 810 func (r Notification_User_Subscriber_Preference) Id(id int) Notification_User_Subscriber_Preference {
811 r.Options.Id = &id
812 return r
813 }
814 815 func (r Notification_User_Subscriber_Preference) Mask(mask string) Notification_User_Subscriber_Preference {
816 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
817 mask = fmt.Sprintf("mask[%s]", mask)
818 }
819 820 r.Options.Mask = mask
821 return r
822 }
823 824 func (r Notification_User_Subscriber_Preference) Filter(filter string) Notification_User_Subscriber_Preference {
825 r.Options.Filter = filter
826 return r
827 }
828 829 func (r Notification_User_Subscriber_Preference) Limit(limit int) Notification_User_Subscriber_Preference {
830 r.Options.Limit = &limit
831 return r
832 }
833 834 func (r Notification_User_Subscriber_Preference) Offset(offset int) Notification_User_Subscriber_Preference {
835 r.Options.Offset = &offset
836 return r
837 }
838 839 // Use the method to create a new notification preference for a subscriber
840 func (r Notification_User_Subscriber_Preference) CreateObject(templateObject *datatypes.Notification_User_Subscriber_Preference) (resp bool, err error) {
841 params := []interface{}{
842 templateObject,
843 }
844 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Preference", "createObject", params, &r.Options, &resp)
845 return
846 }
847 848 // no documentation yet
849 func (r Notification_User_Subscriber_Preference) EditObjects(templateObjects []datatypes.Notification_User_Subscriber_Preference) (resp bool, err error) {
850 params := []interface{}{
851 templateObjects,
852 }
853 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Preference", "editObjects", params, &r.Options, &resp)
854 return
855 }
856 857 // Retrieve Details such name, keyname, minimum and maximum values for the preference.
858 func (r Notification_User_Subscriber_Preference) GetDefaultPreference() (resp datatypes.Notification_Preference, err error) {
859 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Preference", "getDefaultPreference", nil, &r.Options, &resp)
860 return
861 }
862 863 // Retrieve Details of the subscriber tied to the preference.
864 func (r Notification_User_Subscriber_Preference) GetNotificationUserSubscriber() (resp datatypes.Notification_User_Subscriber, err error) {
865 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Preference", "getNotificationUserSubscriber", nil, &r.Options, &resp)
866 return
867 }
868 869 // no documentation yet
870 func (r Notification_User_Subscriber_Preference) GetObject() (resp datatypes.Notification_User_Subscriber_Preference, err error) {
871 err = r.Session.DoRequest("SoftLayer_Notification_User_Subscriber_Preference", "getObject", nil, &r.Options, &resp)
872 return
873 }
874