brand.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_Brand data type contains brand information relating to the single SoftLayer customer account.
26 //
27 // IBM Cloud Infrastructure customers are unable to change their brand information in the portal or the API.
28 type Brand struct {
29 Session session.SLSession
30 Options sl.Options
31 }
32
33 // GetBrandService returns an instance of the Brand SoftLayer service
34 func GetBrandService(sess session.SLSession) Brand {
35 return Brand{Session: sess}
36 }
37
38 func (r Brand) Id(id int) Brand {
39 r.Options.Id = &id
40 return r
41 }
42
43 func (r Brand) Mask(mask string) Brand {
44 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
45 mask = fmt.Sprintf("mask[%s]", mask)
46 }
47
48 r.Options.Mask = mask
49 return r
50 }
51
52 func (r Brand) Filter(filter string) Brand {
53 r.Options.Filter = filter
54 return r
55 }
56
57 func (r Brand) Limit(limit int) Brand {
58 r.Options.Limit = &limit
59 return r
60 }
61
62 func (r Brand) Offset(offset int) Brand {
63 r.Options.Offset = &offset
64 return r
65 }
66
67 // Create a new customer account record. By default, the newly created account will be associated to a platform (PaaS) account. To skip the automatic creation and linking to a new platform account, set the <em>bluemixLinkedFlag</em> to <strong>false</strong> on the account template.
68 func (r Brand) CreateCustomerAccount(account *datatypes.Account, bypassDuplicateAccountCheck *bool) (resp datatypes.Account, err error) {
69 params := []interface{}{
70 account,
71 bypassDuplicateAccountCheck,
72 }
73 err = r.Session.DoRequest("SoftLayer_Brand", "createCustomerAccount", params, &r.Options, &resp)
74 return
75 }
76
77 // createObject() allows the creation of a new brand. This will also create an `account`
78 // to serve as the owner of the brand.
79 //
80 // In order to create a brand, a template object must be sent in with several required values.
81 //
82 // ### Input [[SoftLayer_Brand]]
83 //
84 // - `name`
85 // - Name of brand
86 // - Required
87 // - Type: string
88 //
89 // - `keyName`
90 // - Reference key name
91 // - Required
92 // - Type: string
93 //
94 // - `longName`
95 // - More descriptive name of brand
96 // - Required
97 // - Type: string
98 //
99 // - `account.firstName`
100 // - First Name of account contact
101 // - Required
102 // - Type: string
103 //
104 // - `account.lastName`
105 // - Last Name of account contact
106 // - Required
107 // - Type: string
108 //
109 // - `account.address1`
110 // - Street Address of company
111 // - Required
112 // - Type: string
113 //
114 // - `account.address2`
115 // - Street Address of company
116 // - Optional
117 // - Type: string
118 //
119 // - `account.city`
120 // - City of company
121 // - Required
122 // - Type: string
123 //
124 // - `account.state`
125 // - State of company (if applicable)
126 // - Conditionally Required
127 // - Type: string
128 //
129 // - `account.postalCode`
130 // - Postal Code of company
131 // - Required
132 // - Type: string
133 //
134 // - `account.country`
135 // - Country of company
136 // - Required
137 // - Type: string
138 //
139 // - `account.officePhone`
140 // - Office Phone number of Company
141 // - Required
142 // - Type: string
143 //
144 // - `account.alternatePhone`
145 // - Alternate Phone number of Company
146 // - Optional
147 // - Type: string
148 //
149 // - `account.companyName`
150 // - Name of company
151 // - Required
152 // - Type: string
153 //
154 // - `account.email`
155 // - Email address of account contact
156 // - Required
157 // - Type: string
158 //
159 // REST Example:
160 // ```
161 //
162 // curl -X POST -d '{
163 // "parameters":[{
164 // "name": "Brand Corp",
165 // "keyName": "BRAND_CORP",
166 // "longName": "Brand Corporation",
167 // "account": {
168 // "firstName": "Gloria",
169 // "lastName": "Brand",
170 // "address1": "123 Drive",
171 // "city": "Boston",
172 // "state": "MA",
173 // "postalCode": "02107",
174 // "country": "US",
175 // "companyName": "Brand Corp",
176 // "officePhone": "857-111-1111",
177 // "email": "noreply@example.com"
178 // }
179 // }]
180 // }' https://api.softlayer.com/rest/v3.1/SoftLayer_Brand/createObject.json
181 //
182 // ```
183 func (r Brand) CreateObject(templateObject *datatypes.Brand) (resp datatypes.Brand, err error) {
184 params := []interface{}{
185 templateObject,
186 }
187 err = r.Session.DoRequest("SoftLayer_Brand", "createObject", params, &r.Options, &resp)
188 return
189 }
190
191 // Disable an account associated with this Brand. Anything that would disqualify the account from being disabled will cause an exception to be raised.
192 func (r Brand) DisableAccount(accountId *int) (err error) {
193 var resp datatypes.Void
194 params := []interface{}{
195 accountId,
196 }
197 err = r.Session.DoRequest("SoftLayer_Brand", "disableAccount", params, &r.Options, &resp)
198 return
199 }
200
201 // Retrieve
202 func (r Brand) GetAccount() (resp datatypes.Account, err error) {
203 err = r.Session.DoRequest("SoftLayer_Brand", "getAccount", nil, &r.Options, &resp)
204 return
205 }
206
207 // Retrieve All accounts owned by the brand.
208 func (r Brand) GetAllOwnedAccounts() (resp []datatypes.Account, err error) {
209 err = r.Session.DoRequest("SoftLayer_Brand", "getAllOwnedAccounts", nil, &r.Options, &resp)
210 return
211 }
212
213 // (DEPRECATED) Use [[SoftLayer_Ticket_Subject::getAllObjects]] method.
214 // Deprecated: This function has been marked as deprecated.
215 func (r Brand) GetAllTicketSubjects(account *datatypes.Account) (resp []datatypes.Ticket_Subject, err error) {
216 params := []interface{}{
217 account,
218 }
219 err = r.Session.DoRequest("SoftLayer_Brand", "getAllTicketSubjects", params, &r.Options, &resp)
220 return
221 }
222
223 // Retrieve This flag indicates if creation of accounts is allowed.
224 func (r Brand) GetAllowAccountCreationFlag() (resp bool, err error) {
225 err = r.Session.DoRequest("SoftLayer_Brand", "getAllowAccountCreationFlag", nil, &r.Options, &resp)
226 return
227 }
228
229 // Retrieve Returns snapshots of billing items recorded periodically given an account ID owned by the brand those billing items belong to. Retrieving billing item snapshots is more performant than retrieving billing items directly and performs less relational joins improving retrieval efficiency. The downside is, they are not real time, and do not share relational parity with the original billing item.
230 func (r Brand) GetBillingItemSnapshots() (resp []datatypes.Billing_Item_Chronicle, err error) {
231 err = r.Session.DoRequest("SoftLayer_Brand", "getBillingItemSnapshots", nil, &r.Options, &resp)
232 return
233 }
234
235 // This service returns the snapshots of billing items recorded periodically given an account ID. The provided account ID must be owned by the brand that calls this service. In this context, it can be interpreted that the billing items snapshots belong to both the account and that accounts brand. Retrieving billing item snapshots is more performant than retrieving billing items directly and performs less relational joins improving retrieval efficiency.
236 //
237 // The downside is, they are not real time, and do not share relational parity with the original billing item.
238 func (r Brand) GetBillingItemSnapshotsForSingleOwnedAccount(accountId *int) (resp []datatypes.Billing_Item_Chronicle, err error) {
239 params := []interface{}{
240 accountId,
241 }
242 err = r.Session.DoRequest("SoftLayer_Brand", "getBillingItemSnapshotsForSingleOwnedAccount", params, &r.Options, &resp)
243 return
244 }
245
246 // This service returns the snapshots of billing items recorded periodically given an account ID owned by the brand those billing items belong to. Retrieving billing item snapshots is more performant than retrieving billing items directly and performs less relational joins improving retrieval efficiency.
247 //
248 // The downside is, they are not real time, and do not share relational parity with the original billing item.
249 func (r Brand) GetBillingItemSnapshotsWithExternalAccountId(externalAccountId *string) (resp []datatypes.Billing_Item_Chronicle, err error) {
250 params := []interface{}{
251 externalAccountId,
252 }
253 err = r.Session.DoRequest("SoftLayer_Brand", "getBillingItemSnapshotsWithExternalAccountId", params, &r.Options, &resp)
254 return
255 }
256
257 // Retrieve Business Partner details for the brand. Country Enterprise Code, Channel, Segment, Reseller Level.
258 func (r Brand) GetBusinessPartner() (resp datatypes.Brand_Business_Partner, err error) {
259 err = r.Session.DoRequest("SoftLayer_Brand", "getBusinessPartner", nil, &r.Options, &resp)
260 return
261 }
262
263 // Retrieve Flag indicating if the brand is a business partner.
264 func (r Brand) GetBusinessPartnerFlag() (resp bool, err error) {
265 err = r.Session.DoRequest("SoftLayer_Brand", "getBusinessPartnerFlag", nil, &r.Options, &resp)
266 return
267 }
268
269 // Retrieve The Product Catalog for the Brand
270 func (r Brand) GetCatalog() (resp datatypes.Product_Catalog, err error) {
271 err = r.Session.DoRequest("SoftLayer_Brand", "getCatalog", nil, &r.Options, &resp)
272 return
273 }
274
275 // Retrieve the contact information for the brand such as the corporate or support contact. This will include the contact name, telephone number, fax number, email address, and mailing address of the contact.
276 func (r Brand) GetContactInformation() (resp []datatypes.Brand_Contact, err error) {
277 err = r.Session.DoRequest("SoftLayer_Brand", "getContactInformation", nil, &r.Options, &resp)
278 return
279 }
280
281 // Retrieve The contacts for the brand.
282 func (r Brand) GetContacts() (resp []datatypes.Brand_Contact, err error) {
283 err = r.Session.DoRequest("SoftLayer_Brand", "getContacts", nil, &r.Options, &resp)
284 return
285 }
286
287 // Retrieve This references relationship between brands, locations and countries associated with a user's account that are ineligible when ordering products. For example, the India datacenter may not be available on this brand for customers that live in Great Britain.
288 func (r Brand) GetCustomerCountryLocationRestrictions() (resp []datatypes.Brand_Restriction_Location_CustomerCountry, err error) {
289 err = r.Session.DoRequest("SoftLayer_Brand", "getCustomerCountryLocationRestrictions", nil, &r.Options, &resp)
290 return
291 }
292
293 // Retrieve
294 func (r Brand) GetDistributor() (resp datatypes.Brand, err error) {
295 err = r.Session.DoRequest("SoftLayer_Brand", "getDistributor", nil, &r.Options, &resp)
296 return
297 }
298
299 // Retrieve
300 func (r Brand) GetDistributorChildFlag() (resp bool, err error) {
301 err = r.Session.DoRequest("SoftLayer_Brand", "getDistributorChildFlag", nil, &r.Options, &resp)
302 return
303 }
304
305 // Retrieve
306 func (r Brand) GetDistributorFlag() (resp string, err error) {
307 err = r.Session.DoRequest("SoftLayer_Brand", "getDistributorFlag", nil, &r.Options, &resp)
308 return
309 }
310
311 // Retrieve An account's associated hardware objects.
312 func (r Brand) GetHardware() (resp []datatypes.Hardware, err error) {
313 err = r.Session.DoRequest("SoftLayer_Brand", "getHardware", nil, &r.Options, &resp)
314 return
315 }
316
317 // Retrieve
318 func (r Brand) GetHasAgentAdvancedSupportFlag() (resp bool, err error) {
319 err = r.Session.DoRequest("SoftLayer_Brand", "getHasAgentAdvancedSupportFlag", nil, &r.Options, &resp)
320 return
321 }
322
323 // Retrieve
324 func (r Brand) GetHasAgentSupportFlag() (resp bool, err error) {
325 err = r.Session.DoRequest("SoftLayer_Brand", "getHasAgentSupportFlag", nil, &r.Options, &resp)
326 return
327 }
328
329 // Get the payment processor merchant name.
330 func (r Brand) GetMerchantName() (resp string, err error) {
331 err = r.Session.DoRequest("SoftLayer_Brand", "getMerchantName", nil, &r.Options, &resp)
332 return
333 }
334
335 // no documentation yet
336 func (r Brand) GetObject() (resp datatypes.Brand, err error) {
337 err = r.Session.DoRequest("SoftLayer_Brand", "getObject", nil, &r.Options, &resp)
338 return
339 }
340
341 // Retrieve
342 func (r Brand) GetOpenTickets() (resp []datatypes.Ticket, err error) {
343 err = r.Session.DoRequest("SoftLayer_Brand", "getOpenTickets", nil, &r.Options, &resp)
344 return
345 }
346
347 // Retrieve Active accounts owned by the brand.
348 func (r Brand) GetOwnedAccounts() (resp []datatypes.Account, err error) {
349 err = r.Session.DoRequest("SoftLayer_Brand", "getOwnedAccounts", nil, &r.Options, &resp)
350 return
351 }
352
353 // Retrieve
354 func (r Brand) GetSecurityLevel() (resp datatypes.Security_Level, err error) {
355 err = r.Session.DoRequest("SoftLayer_Brand", "getSecurityLevel", nil, &r.Options, &resp)
356 return
357 }
358
359 // Retrieve
360 func (r Brand) GetTicketGroups() (resp []datatypes.Ticket_Group, err error) {
361 err = r.Session.DoRequest("SoftLayer_Brand", "getTicketGroups", nil, &r.Options, &resp)
362 return
363 }
364
365 // Retrieve
366 func (r Brand) GetTickets() (resp []datatypes.Ticket, err error) {
367 err = r.Session.DoRequest("SoftLayer_Brand", "getTickets", nil, &r.Options, &resp)
368 return
369 }
370
371 // (DEPRECATED) Use [[SoftLayer_User_Customer::getImpersonationToken]] method.
372 // Deprecated: This function has been marked as deprecated.
373 func (r Brand) GetToken(userId *int) (resp string, err error) {
374 params := []interface{}{
375 userId,
376 }
377 err = r.Session.DoRequest("SoftLayer_Brand", "getToken", params, &r.Options, &resp)
378 return
379 }
380
381 // Retrieve
382 func (r Brand) GetUsers() (resp []datatypes.User_Customer, err error) {
383 err = r.Session.DoRequest("SoftLayer_Brand", "getUsers", nil, &r.Options, &resp)
384 return
385 }
386
387 // Retrieve An account's associated virtual guest objects.
388 func (r Brand) GetVirtualGuests() (resp []datatypes.Virtual_Guest, err error) {
389 err = r.Session.DoRequest("SoftLayer_Brand", "getVirtualGuests", nil, &r.Options, &resp)
390 return
391 }
392
393 // Check if the brand is IBM SLIC top level brand or sub brand.
394 func (r Brand) IsIbmSlicBrand() (resp bool, err error) {
395 err = r.Session.DoRequest("SoftLayer_Brand", "isIbmSlicBrand", nil, &r.Options, &resp)
396 return
397 }
398
399 // Check if the alternate billing system of brand is Bluemix.
400 func (r Brand) IsPlatformServicesBrand() (resp bool, err error) {
401 err = r.Session.DoRequest("SoftLayer_Brand", "isPlatformServicesBrand", nil, &r.Options, &resp)
402 return
403 }
404
405 // Will attempt to migrate an external account to the brand in context.
406 func (r Brand) MigrateExternalAccount(accountId *int) (resp datatypes.Account_Brand_Migration_Request, err error) {
407 params := []interface{}{
408 accountId,
409 }
410 err = r.Session.DoRequest("SoftLayer_Brand", "migrateExternalAccount", params, &r.Options, &resp)
411 return
412 }
413
414 // Reactivate an account associated with this Brand. Anything that would disqualify the account from being reactivated will cause an exception to be raised.
415 func (r Brand) ReactivateAccount(accountId *int) (err error) {
416 var resp datatypes.Void
417 params := []interface{}{
418 accountId,
419 }
420 err = r.Session.DoRequest("SoftLayer_Brand", "reactivateAccount", params, &r.Options, &resp)
421 return
422 }
423
424 // When this service is called given an IBM Cloud infrastructure account ID owned by the calling brand, the process is started to refresh the billing item snapshots belonging to that account. This refresh is async and can take an undetermined amount of time. Even if this endpoint returns an OK, it doesn't guarantee that refresh did not fail or encounter issues.
425 func (r Brand) RefreshBillingItemSnapshot(accountId *int) (resp bool, err error) {
426 params := []interface{}{
427 accountId,
428 }
429 err = r.Session.DoRequest("SoftLayer_Brand", "refreshBillingItemSnapshot", params, &r.Options, &resp)
430 return
431 }
432
433 // Verify that an account may be disabled by a Brand Agent. Anything that would disqualify the account from being disabled will cause an exception to be raised.
434 func (r Brand) VerifyCanDisableAccount(accountId *int) (err error) {
435 var resp datatypes.Void
436 params := []interface{}{
437 accountId,
438 }
439 err = r.Session.DoRequest("SoftLayer_Brand", "verifyCanDisableAccount", params, &r.Options, &resp)
440 return
441 }
442
443 // Verify that an account may be reactivated by a Brand Agent. Anything that would disqualify the account from being reactivated will cause an exception to be raised.
444 func (r Brand) VerifyCanReactivateAccount(accountId *int) (err error) {
445 var resp datatypes.Void
446 params := []interface{}{
447 accountId,
448 }
449 err = r.Session.DoRequest("SoftLayer_Brand", "verifyCanReactivateAccount", params, &r.Options, &resp)
450 return
451 }
452
453 // Contains business partner details associated with a brand. Country Enterprise Identifier (CEID), Channel ID, Segment ID and Reseller Level.
454 type Brand_Business_Partner struct {
455 Session session.SLSession
456 Options sl.Options
457 }
458
459 // GetBrandBusinessPartnerService returns an instance of the Brand_Business_Partner SoftLayer service
460 func GetBrandBusinessPartnerService(sess session.SLSession) Brand_Business_Partner {
461 return Brand_Business_Partner{Session: sess}
462 }
463
464 func (r Brand_Business_Partner) Id(id int) Brand_Business_Partner {
465 r.Options.Id = &id
466 return r
467 }
468
469 func (r Brand_Business_Partner) Mask(mask string) Brand_Business_Partner {
470 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
471 mask = fmt.Sprintf("mask[%s]", mask)
472 }
473
474 r.Options.Mask = mask
475 return r
476 }
477
478 func (r Brand_Business_Partner) Filter(filter string) Brand_Business_Partner {
479 r.Options.Filter = filter
480 return r
481 }
482
483 func (r Brand_Business_Partner) Limit(limit int) Brand_Business_Partner {
484 r.Options.Limit = &limit
485 return r
486 }
487
488 func (r Brand_Business_Partner) Offset(offset int) Brand_Business_Partner {
489 r.Options.Offset = &offset
490 return r
491 }
492
493 // Retrieve Brand associated with the business partner data
494 func (r Brand_Business_Partner) GetBrand() (resp datatypes.Brand, err error) {
495 err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getBrand", nil, &r.Options, &resp)
496 return
497 }
498
499 // Retrieve Channel indicator used to categorize business partner revenue.
500 func (r Brand_Business_Partner) GetChannel() (resp datatypes.Business_Partner_Channel, err error) {
501 err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getChannel", nil, &r.Options, &resp)
502 return
503 }
504
505 // no documentation yet
506 func (r Brand_Business_Partner) GetObject() (resp datatypes.Brand_Business_Partner, err error) {
507 err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getObject", nil, &r.Options, &resp)
508 return
509 }
510
511 // Retrieve Segment indicator used to categorize business partner revenue.
512 func (r Brand_Business_Partner) GetSegment() (resp datatypes.Business_Partner_Segment, err error) {
513 err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getSegment", nil, &r.Options, &resp)
514 return
515 }
516
517 // The [[SoftLayer_Brand_Restriction_Location_CustomerCountry]] data type defines the relationship between brands, locations and countries associated with a user's account that are ineligible when ordering products. For example, the India datacenter may not be available on the SoftLayer US brand for customers that live in Great Britain.
518 type Brand_Restriction_Location_CustomerCountry struct {
519 Session session.SLSession
520 Options sl.Options
521 }
522
523 // GetBrandRestrictionLocationCustomerCountryService returns an instance of the Brand_Restriction_Location_CustomerCountry SoftLayer service
524 func GetBrandRestrictionLocationCustomerCountryService(sess session.SLSession) Brand_Restriction_Location_CustomerCountry {
525 return Brand_Restriction_Location_CustomerCountry{Session: sess}
526 }
527
528 func (r Brand_Restriction_Location_CustomerCountry) Id(id int) Brand_Restriction_Location_CustomerCountry {
529 r.Options.Id = &id
530 return r
531 }
532
533 func (r Brand_Restriction_Location_CustomerCountry) Mask(mask string) Brand_Restriction_Location_CustomerCountry {
534 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
535 mask = fmt.Sprintf("mask[%s]", mask)
536 }
537
538 r.Options.Mask = mask
539 return r
540 }
541
542 func (r Brand_Restriction_Location_CustomerCountry) Filter(filter string) Brand_Restriction_Location_CustomerCountry {
543 r.Options.Filter = filter
544 return r
545 }
546
547 func (r Brand_Restriction_Location_CustomerCountry) Limit(limit int) Brand_Restriction_Location_CustomerCountry {
548 r.Options.Limit = &limit
549 return r
550 }
551
552 func (r Brand_Restriction_Location_CustomerCountry) Offset(offset int) Brand_Restriction_Location_CustomerCountry {
553 r.Options.Offset = &offset
554 return r
555 }
556
557 // no documentation yet
558 func (r Brand_Restriction_Location_CustomerCountry) GetAllObjects() (resp []datatypes.Brand_Restriction_Location_CustomerCountry, err error) {
559 err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getAllObjects", nil, &r.Options, &resp)
560 return
561 }
562
563 // Retrieve This references the brand that has a brand-location-country restriction setup.
564 func (r Brand_Restriction_Location_CustomerCountry) GetBrand() (resp datatypes.Brand, err error) {
565 err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getBrand", nil, &r.Options, &resp)
566 return
567 }
568
569 // Retrieve This references the datacenter that has a brand-location-country restriction setup. For example, if a datacenter is listed with a restriction for Canada, a Canadian customer may not be eligible to order services at that location.
570 func (r Brand_Restriction_Location_CustomerCountry) GetLocation() (resp datatypes.Location, err error) {
571 err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getLocation", nil, &r.Options, &resp)
572 return
573 }
574
575 // no documentation yet
576 func (r Brand_Restriction_Location_CustomerCountry) GetObject() (resp datatypes.Brand_Restriction_Location_CustomerCountry, err error) {
577 err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getObject", nil, &r.Options, &resp)
578 return
579 }
580