layout.go raw

   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  // The SoftLayer_Layout_Container contains definitions for default page layouts
  26  type Layout_Container struct {
  27  	Session session.SLSession
  28  	Options sl.Options
  29  }
  30  
  31  // GetLayoutContainerService returns an instance of the Layout_Container SoftLayer service
  32  func GetLayoutContainerService(sess session.SLSession) Layout_Container {
  33  	return Layout_Container{Session: sess}
  34  }
  35  
  36  func (r Layout_Container) Id(id int) Layout_Container {
  37  	r.Options.Id = &id
  38  	return r
  39  }
  40  
  41  func (r Layout_Container) Mask(mask string) Layout_Container {
  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 Layout_Container) Filter(filter string) Layout_Container {
  51  	r.Options.Filter = filter
  52  	return r
  53  }
  54  
  55  func (r Layout_Container) Limit(limit int) Layout_Container {
  56  	r.Options.Limit = &limit
  57  	return r
  58  }
  59  
  60  func (r Layout_Container) Offset(offset int) Layout_Container {
  61  	r.Options.Offset = &offset
  62  	return r
  63  }
  64  
  65  // Use this method to retrieve all active layout containers that can be customized.
  66  func (r Layout_Container) GetAllObjects() (resp []datatypes.Layout_Container, err error) {
  67  	err = r.Session.DoRequest("SoftLayer_Layout_Container", "getAllObjects", nil, &r.Options, &resp)
  68  	return
  69  }
  70  
  71  // Retrieve The type of the layout container object
  72  func (r Layout_Container) GetLayoutContainerType() (resp datatypes.Layout_Container_Type, err error) {
  73  	err = r.Session.DoRequest("SoftLayer_Layout_Container", "getLayoutContainerType", nil, &r.Options, &resp)
  74  	return
  75  }
  76  
  77  // Retrieve The layout items assigned to this layout container
  78  func (r Layout_Container) GetLayoutItems() (resp []datatypes.Layout_Item, err error) {
  79  	err = r.Session.DoRequest("SoftLayer_Layout_Container", "getLayoutItems", nil, &r.Options, &resp)
  80  	return
  81  }
  82  
  83  // no documentation yet
  84  func (r Layout_Container) GetObject() (resp datatypes.Layout_Container, err error) {
  85  	err = r.Session.DoRequest("SoftLayer_Layout_Container", "getObject", nil, &r.Options, &resp)
  86  	return
  87  }
  88  
  89  // The SoftLayer_Layout_Item contains definitions for default layout items
  90  type Layout_Item struct {
  91  	Session session.SLSession
  92  	Options sl.Options
  93  }
  94  
  95  // GetLayoutItemService returns an instance of the Layout_Item SoftLayer service
  96  func GetLayoutItemService(sess session.SLSession) Layout_Item {
  97  	return Layout_Item{Session: sess}
  98  }
  99  
 100  func (r Layout_Item) Id(id int) Layout_Item {
 101  	r.Options.Id = &id
 102  	return r
 103  }
 104  
 105  func (r Layout_Item) Mask(mask string) Layout_Item {
 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 Layout_Item) Filter(filter string) Layout_Item {
 115  	r.Options.Filter = filter
 116  	return r
 117  }
 118  
 119  func (r Layout_Item) Limit(limit int) Layout_Item {
 120  	r.Options.Limit = &limit
 121  	return r
 122  }
 123  
 124  func (r Layout_Item) Offset(offset int) Layout_Item {
 125  	r.Options.Offset = &offset
 126  	return r
 127  }
 128  
 129  // Retrieve The layout preferences assigned to this layout item
 130  func (r Layout_Item) GetLayoutItemPreferences() (resp []datatypes.Layout_Preference, err error) {
 131  	err = r.Session.DoRequest("SoftLayer_Layout_Item", "getLayoutItemPreferences", nil, &r.Options, &resp)
 132  	return
 133  }
 134  
 135  // Retrieve The type of the layout item object
 136  func (r Layout_Item) GetLayoutItemType() (resp datatypes.Layout_Item_Type, err error) {
 137  	err = r.Session.DoRequest("SoftLayer_Layout_Item", "getLayoutItemType", nil, &r.Options, &resp)
 138  	return
 139  }
 140  
 141  // no documentation yet
 142  func (r Layout_Item) GetObject() (resp datatypes.Layout_Item, err error) {
 143  	err = r.Session.DoRequest("SoftLayer_Layout_Item", "getObject", nil, &r.Options, &resp)
 144  	return
 145  }
 146  
 147  // The SoftLayer_Layout_Profile contains the definition of the layout profile
 148  type Layout_Profile struct {
 149  	Session session.SLSession
 150  	Options sl.Options
 151  }
 152  
 153  // GetLayoutProfileService returns an instance of the Layout_Profile SoftLayer service
 154  func GetLayoutProfileService(sess session.SLSession) Layout_Profile {
 155  	return Layout_Profile{Session: sess}
 156  }
 157  
 158  func (r Layout_Profile) Id(id int) Layout_Profile {
 159  	r.Options.Id = &id
 160  	return r
 161  }
 162  
 163  func (r Layout_Profile) Mask(mask string) Layout_Profile {
 164  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
 165  		mask = fmt.Sprintf("mask[%s]", mask)
 166  	}
 167  
 168  	r.Options.Mask = mask
 169  	return r
 170  }
 171  
 172  func (r Layout_Profile) Filter(filter string) Layout_Profile {
 173  	r.Options.Filter = filter
 174  	return r
 175  }
 176  
 177  func (r Layout_Profile) Limit(limit int) Layout_Profile {
 178  	r.Options.Limit = &limit
 179  	return r
 180  }
 181  
 182  func (r Layout_Profile) Offset(offset int) Layout_Profile {
 183  	r.Options.Offset = &offset
 184  	return r
 185  }
 186  
 187  // This method creates a new layout profile object.
 188  func (r Layout_Profile) CreateObject(templateObject *datatypes.Layout_Profile) (resp bool, err error) {
 189  	params := []interface{}{
 190  		templateObject,
 191  	}
 192  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "createObject", params, &r.Options, &resp)
 193  	return
 194  }
 195  
 196  // This method deletes an existing layout profile and associated custom preferences
 197  func (r Layout_Profile) DeleteObject() (resp bool, err error) {
 198  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "deleteObject", nil, &r.Options, &resp)
 199  	return
 200  }
 201  
 202  // This method edits an existing layout profile object by passing in a modified instance of the object.
 203  func (r Layout_Profile) EditObject(templateObject *datatypes.Layout_Profile) (resp bool, err error) {
 204  	params := []interface{}{
 205  		templateObject,
 206  	}
 207  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "editObject", params, &r.Options, &resp)
 208  	return
 209  }
 210  
 211  // Retrieve
 212  func (r Layout_Profile) GetLayoutContainers() (resp []datatypes.Layout_Container, err error) {
 213  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "getLayoutContainers", nil, &r.Options, &resp)
 214  	return
 215  }
 216  
 217  // Retrieve
 218  func (r Layout_Profile) GetLayoutPreferences() (resp []datatypes.Layout_Profile_Preference, err error) {
 219  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "getLayoutPreferences", nil, &r.Options, &resp)
 220  	return
 221  }
 222  
 223  // no documentation yet
 224  func (r Layout_Profile) GetObject() (resp datatypes.Layout_Profile, err error) {
 225  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "getObject", nil, &r.Options, &resp)
 226  	return
 227  }
 228  
 229  // This method modifies an existing associated [[SoftLayer_Layout_Profile_Preference]] object. If the preference object being modified is a default value object, a new record is created to override the default value.
 230  //
 231  // Only preferences that are assigned to a profile may be updated. Attempts to update a non-existent preference object will result in an exception being thrown.
 232  func (r Layout_Profile) ModifyPreference(templateObject *datatypes.Layout_Profile_Preference) (resp datatypes.Layout_Profile_Preference, err error) {
 233  	params := []interface{}{
 234  		templateObject,
 235  	}
 236  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "modifyPreference", params, &r.Options, &resp)
 237  	return
 238  }
 239  
 240  // Using this method, multiple [[SoftLayer_Layout_Profile_Preference]] objects may be updated at once.
 241  //
 242  // Refer to [[SoftLayer_Layout_Profile::modifyPreference()]] for more information.
 243  func (r Layout_Profile) ModifyPreferences(layoutPreferenceObjects []datatypes.Layout_Profile_Preference) (resp []datatypes.Layout_Profile_Preference, err error) {
 244  	params := []interface{}{
 245  		layoutPreferenceObjects,
 246  	}
 247  	err = r.Session.DoRequest("SoftLayer_Layout_Profile", "modifyPreferences", params, &r.Options, &resp)
 248  	return
 249  }
 250  
 251  // no documentation yet
 252  type Layout_Profile_Containers struct {
 253  	Session session.SLSession
 254  	Options sl.Options
 255  }
 256  
 257  // GetLayoutProfileContainersService returns an instance of the Layout_Profile_Containers SoftLayer service
 258  func GetLayoutProfileContainersService(sess session.SLSession) Layout_Profile_Containers {
 259  	return Layout_Profile_Containers{Session: sess}
 260  }
 261  
 262  func (r Layout_Profile_Containers) Id(id int) Layout_Profile_Containers {
 263  	r.Options.Id = &id
 264  	return r
 265  }
 266  
 267  func (r Layout_Profile_Containers) Mask(mask string) Layout_Profile_Containers {
 268  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
 269  		mask = fmt.Sprintf("mask[%s]", mask)
 270  	}
 271  
 272  	r.Options.Mask = mask
 273  	return r
 274  }
 275  
 276  func (r Layout_Profile_Containers) Filter(filter string) Layout_Profile_Containers {
 277  	r.Options.Filter = filter
 278  	return r
 279  }
 280  
 281  func (r Layout_Profile_Containers) Limit(limit int) Layout_Profile_Containers {
 282  	r.Options.Limit = &limit
 283  	return r
 284  }
 285  
 286  func (r Layout_Profile_Containers) Offset(offset int) Layout_Profile_Containers {
 287  	r.Options.Offset = &offset
 288  	return r
 289  }
 290  
 291  // no documentation yet
 292  func (r Layout_Profile_Containers) CreateObject(templateObject *datatypes.Layout_Profile_Containers) (resp datatypes.Layout_Profile_Containers, err error) {
 293  	params := []interface{}{
 294  		templateObject,
 295  	}
 296  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Containers", "createObject", params, &r.Options, &resp)
 297  	return
 298  }
 299  
 300  // no documentation yet
 301  func (r Layout_Profile_Containers) EditObject(templateObject *datatypes.Layout_Profile_Containers) (resp bool, err error) {
 302  	params := []interface{}{
 303  		templateObject,
 304  	}
 305  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Containers", "editObject", params, &r.Options, &resp)
 306  	return
 307  }
 308  
 309  // Retrieve The container to be contained
 310  func (r Layout_Profile_Containers) GetLayoutContainerType() (resp datatypes.Layout_Container, err error) {
 311  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Containers", "getLayoutContainerType", nil, &r.Options, &resp)
 312  	return
 313  }
 314  
 315  // Retrieve The profile containing this container
 316  func (r Layout_Profile_Containers) GetLayoutProfile() (resp datatypes.Layout_Profile, err error) {
 317  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Containers", "getLayoutProfile", nil, &r.Options, &resp)
 318  	return
 319  }
 320  
 321  // no documentation yet
 322  func (r Layout_Profile_Containers) GetObject() (resp datatypes.Layout_Profile_Containers, err error) {
 323  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Containers", "getObject", nil, &r.Options, &resp)
 324  	return
 325  }
 326  
 327  // no documentation yet
 328  type Layout_Profile_Customer struct {
 329  	Session session.SLSession
 330  	Options sl.Options
 331  }
 332  
 333  // GetLayoutProfileCustomerService returns an instance of the Layout_Profile_Customer SoftLayer service
 334  func GetLayoutProfileCustomerService(sess session.SLSession) Layout_Profile_Customer {
 335  	return Layout_Profile_Customer{Session: sess}
 336  }
 337  
 338  func (r Layout_Profile_Customer) Id(id int) Layout_Profile_Customer {
 339  	r.Options.Id = &id
 340  	return r
 341  }
 342  
 343  func (r Layout_Profile_Customer) Mask(mask string) Layout_Profile_Customer {
 344  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
 345  		mask = fmt.Sprintf("mask[%s]", mask)
 346  	}
 347  
 348  	r.Options.Mask = mask
 349  	return r
 350  }
 351  
 352  func (r Layout_Profile_Customer) Filter(filter string) Layout_Profile_Customer {
 353  	r.Options.Filter = filter
 354  	return r
 355  }
 356  
 357  func (r Layout_Profile_Customer) Limit(limit int) Layout_Profile_Customer {
 358  	r.Options.Limit = &limit
 359  	return r
 360  }
 361  
 362  func (r Layout_Profile_Customer) Offset(offset int) Layout_Profile_Customer {
 363  	r.Options.Offset = &offset
 364  	return r
 365  }
 366  
 367  // This method creates a new layout profile object.
 368  func (r Layout_Profile_Customer) CreateObject(templateObject *datatypes.Layout_Profile) (resp bool, err error) {
 369  	params := []interface{}{
 370  		templateObject,
 371  	}
 372  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "createObject", params, &r.Options, &resp)
 373  	return
 374  }
 375  
 376  // This method deletes an existing layout profile and associated custom preferences
 377  func (r Layout_Profile_Customer) DeleteObject() (resp bool, err error) {
 378  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "deleteObject", nil, &r.Options, &resp)
 379  	return
 380  }
 381  
 382  // This method edits an existing layout profile object by passing in a modified instance of the object.
 383  func (r Layout_Profile_Customer) EditObject(templateObject *datatypes.Layout_Profile) (resp bool, err error) {
 384  	params := []interface{}{
 385  		templateObject,
 386  	}
 387  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "editObject", params, &r.Options, &resp)
 388  	return
 389  }
 390  
 391  // Retrieve
 392  func (r Layout_Profile_Customer) GetLayoutContainers() (resp []datatypes.Layout_Container, err error) {
 393  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "getLayoutContainers", nil, &r.Options, &resp)
 394  	return
 395  }
 396  
 397  // Retrieve
 398  func (r Layout_Profile_Customer) GetLayoutPreferences() (resp []datatypes.Layout_Profile_Preference, err error) {
 399  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "getLayoutPreferences", nil, &r.Options, &resp)
 400  	return
 401  }
 402  
 403  // no documentation yet
 404  func (r Layout_Profile_Customer) GetObject() (resp datatypes.Layout_Profile_Customer, err error) {
 405  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "getObject", nil, &r.Options, &resp)
 406  	return
 407  }
 408  
 409  // Retrieve
 410  func (r Layout_Profile_Customer) GetUserRecord() (resp datatypes.User_Customer, err error) {
 411  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "getUserRecord", nil, &r.Options, &resp)
 412  	return
 413  }
 414  
 415  // This method modifies an existing associated [[SoftLayer_Layout_Profile_Preference]] object. If the preference object being modified is a default value object, a new record is created to override the default value.
 416  //
 417  // Only preferences that are assigned to a profile may be updated. Attempts to update a non-existent preference object will result in an exception being thrown.
 418  func (r Layout_Profile_Customer) ModifyPreference(templateObject *datatypes.Layout_Profile_Preference) (resp datatypes.Layout_Profile_Preference, err error) {
 419  	params := []interface{}{
 420  		templateObject,
 421  	}
 422  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "modifyPreference", params, &r.Options, &resp)
 423  	return
 424  }
 425  
 426  // Using this method, multiple [[SoftLayer_Layout_Profile_Preference]] objects may be updated at once.
 427  //
 428  // Refer to [[SoftLayer_Layout_Profile::modifyPreference()]] for more information.
 429  func (r Layout_Profile_Customer) ModifyPreferences(layoutPreferenceObjects []datatypes.Layout_Profile_Preference) (resp []datatypes.Layout_Profile_Preference, err error) {
 430  	params := []interface{}{
 431  		layoutPreferenceObjects,
 432  	}
 433  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Customer", "modifyPreferences", params, &r.Options, &resp)
 434  	return
 435  }
 436  
 437  // The SoftLayer_Layout_Profile_Preference contains definitions for layout preferences
 438  type Layout_Profile_Preference struct {
 439  	Session session.SLSession
 440  	Options sl.Options
 441  }
 442  
 443  // GetLayoutProfilePreferenceService returns an instance of the Layout_Profile_Preference SoftLayer service
 444  func GetLayoutProfilePreferenceService(sess session.SLSession) Layout_Profile_Preference {
 445  	return Layout_Profile_Preference{Session: sess}
 446  }
 447  
 448  func (r Layout_Profile_Preference) Id(id int) Layout_Profile_Preference {
 449  	r.Options.Id = &id
 450  	return r
 451  }
 452  
 453  func (r Layout_Profile_Preference) Mask(mask string) Layout_Profile_Preference {
 454  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
 455  		mask = fmt.Sprintf("mask[%s]", mask)
 456  	}
 457  
 458  	r.Options.Mask = mask
 459  	return r
 460  }
 461  
 462  func (r Layout_Profile_Preference) Filter(filter string) Layout_Profile_Preference {
 463  	r.Options.Filter = filter
 464  	return r
 465  }
 466  
 467  func (r Layout_Profile_Preference) Limit(limit int) Layout_Profile_Preference {
 468  	r.Options.Limit = &limit
 469  	return r
 470  }
 471  
 472  func (r Layout_Profile_Preference) Offset(offset int) Layout_Profile_Preference {
 473  	r.Options.Offset = &offset
 474  	return r
 475  }
 476  
 477  // Retrieve
 478  func (r Layout_Profile_Preference) GetLayoutContainer() (resp datatypes.Layout_Container, err error) {
 479  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Preference", "getLayoutContainer", nil, &r.Options, &resp)
 480  	return
 481  }
 482  
 483  // Retrieve
 484  func (r Layout_Profile_Preference) GetLayoutItem() (resp datatypes.Layout_Item, err error) {
 485  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Preference", "getLayoutItem", nil, &r.Options, &resp)
 486  	return
 487  }
 488  
 489  // Retrieve
 490  func (r Layout_Profile_Preference) GetLayoutPreference() (resp datatypes.Layout_Preference, err error) {
 491  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Preference", "getLayoutPreference", nil, &r.Options, &resp)
 492  	return
 493  }
 494  
 495  // Retrieve
 496  func (r Layout_Profile_Preference) GetLayoutProfile() (resp datatypes.Layout_Profile, err error) {
 497  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Preference", "getLayoutProfile", nil, &r.Options, &resp)
 498  	return
 499  }
 500  
 501  // no documentation yet
 502  func (r Layout_Profile_Preference) GetObject() (resp datatypes.Layout_Profile_Preference, err error) {
 503  	err = r.Session.DoRequest("SoftLayer_Layout_Profile_Preference", "getObject", nil, &r.Options, &resp)
 504  	return
 505  }
 506