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