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// The SoftLayer_Brand data type contains brand information relating to the single SoftLayer customer account.
33//
34// SoftLayer customers are unable to change their brand information in the portal or the API.
35type Brand struct {
36	Session *session.Session
37	Options sl.Options
38}
39
40// GetBrandService returns an instance of the Brand SoftLayer service
41func GetBrandService(sess *session.Session) Brand {
42	return Brand{Session: sess}
43}
44
45func (r Brand) Id(id int) Brand {
46	r.Options.Id = &id
47	return r
48}
49
50func (r Brand) Mask(mask string) Brand {
51	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
52		mask = fmt.Sprintf("mask[%s]", mask)
53	}
54
55	r.Options.Mask = mask
56	return r
57}
58
59func (r Brand) Filter(filter string) Brand {
60	r.Options.Filter = filter
61	return r
62}
63
64func (r Brand) Limit(limit int) Brand {
65	r.Options.Limit = &limit
66	return r
67}
68
69func (r Brand) Offset(offset int) Brand {
70	r.Options.Offset = &offset
71	return r
72}
73
74// Create a new customer account record.
75func (r Brand) CreateCustomerAccount(account *datatypes.Account, bypassDuplicateAccountCheck *bool) (resp datatypes.Account, err error) {
76	params := []interface{}{
77		account,
78		bypassDuplicateAccountCheck,
79	}
80	err = r.Session.DoRequest("SoftLayer_Brand", "createCustomerAccount", params, &r.Options, &resp)
81	return
82}
83
84// Create a new brand record.
85func (r Brand) CreateObject(templateObject *datatypes.Brand) (resp datatypes.Brand, err error) {
86	params := []interface{}{
87		templateObject,
88	}
89	err = r.Session.DoRequest("SoftLayer_Brand", "createObject", params, &r.Options, &resp)
90	return
91}
92
93// Retrieve
94func (r Brand) GetAccount() (resp datatypes.Account, err error) {
95	err = r.Session.DoRequest("SoftLayer_Brand", "getAccount", nil, &r.Options, &resp)
96	return
97}
98
99// Retrieve All accounts owned by the brand.
100func (r Brand) GetAllOwnedAccounts() (resp []datatypes.Account, err error) {
101	err = r.Session.DoRequest("SoftLayer_Brand", "getAllOwnedAccounts", nil, &r.Options, &resp)
102	return
103}
104
105// (DEPRECATED) Use [[SoftLayer_Ticket_Subject::getAllObjects]] method.
106func (r Brand) GetAllTicketSubjects(account *datatypes.Account) (resp []datatypes.Ticket_Subject, err error) {
107	params := []interface{}{
108		account,
109	}
110	err = r.Session.DoRequest("SoftLayer_Brand", "getAllTicketSubjects", params, &r.Options, &resp)
111	return
112}
113
114// Retrieve This flag indicates if creation of accounts is allowed.
115func (r Brand) GetAllowAccountCreationFlag() (resp bool, err error) {
116	err = r.Session.DoRequest("SoftLayer_Brand", "getAllowAccountCreationFlag", nil, &r.Options, &resp)
117	return
118}
119
120// Retrieve Business Partner details for the brand. Country Enterprise Code, Channel, Segment, Reseller Level.
121func (r Brand) GetBusinessPartner() (resp datatypes.Brand_Business_Partner, err error) {
122	err = r.Session.DoRequest("SoftLayer_Brand", "getBusinessPartner", nil, &r.Options, &resp)
123	return
124}
125
126// Retrieve Flag indicating if the brand is a business partner.
127func (r Brand) GetBusinessPartnerFlag() (resp bool, err error) {
128	err = r.Session.DoRequest("SoftLayer_Brand", "getBusinessPartnerFlag", nil, &r.Options, &resp)
129	return
130}
131
132// Retrieve The Product Catalog for the Brand
133func (r Brand) GetCatalog() (resp datatypes.Product_Catalog, err error) {
134	err = r.Session.DoRequest("SoftLayer_Brand", "getCatalog", nil, &r.Options, &resp)
135	return
136}
137
138// 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.
139func (r Brand) GetContactInformation() (resp []datatypes.Brand_Contact, err error) {
140	err = r.Session.DoRequest("SoftLayer_Brand", "getContactInformation", nil, &r.Options, &resp)
141	return
142}
143
144// Retrieve The contacts for the brand.
145func (r Brand) GetContacts() (resp []datatypes.Brand_Contact, err error) {
146	err = r.Session.DoRequest("SoftLayer_Brand", "getContacts", nil, &r.Options, &resp)
147	return
148}
149
150// 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.
151func (r Brand) GetCustomerCountryLocationRestrictions() (resp []datatypes.Brand_Restriction_Location_CustomerCountry, err error) {
152	err = r.Session.DoRequest("SoftLayer_Brand", "getCustomerCountryLocationRestrictions", nil, &r.Options, &resp)
153	return
154}
155
156// Retrieve
157func (r Brand) GetDistributor() (resp datatypes.Brand, err error) {
158	err = r.Session.DoRequest("SoftLayer_Brand", "getDistributor", nil, &r.Options, &resp)
159	return
160}
161
162// Retrieve
163func (r Brand) GetDistributorChildFlag() (resp bool, err error) {
164	err = r.Session.DoRequest("SoftLayer_Brand", "getDistributorChildFlag", nil, &r.Options, &resp)
165	return
166}
167
168// Retrieve
169func (r Brand) GetDistributorFlag() (resp string, err error) {
170	err = r.Session.DoRequest("SoftLayer_Brand", "getDistributorFlag", nil, &r.Options, &resp)
171	return
172}
173
174// Retrieve An account's associated hardware objects.
175func (r Brand) GetHardware() (resp []datatypes.Hardware, err error) {
176	err = r.Session.DoRequest("SoftLayer_Brand", "getHardware", nil, &r.Options, &resp)
177	return
178}
179
180// Retrieve
181func (r Brand) GetHasAgentSupportFlag() (resp bool, err error) {
182	err = r.Session.DoRequest("SoftLayer_Brand", "getHasAgentSupportFlag", nil, &r.Options, &resp)
183	return
184}
185
186// Get the payment processor merchant name.
187func (r Brand) GetMerchantName() (resp string, err error) {
188	err = r.Session.DoRequest("SoftLayer_Brand", "getMerchantName", nil, &r.Options, &resp)
189	return
190}
191
192// no documentation yet
193func (r Brand) GetObject() (resp datatypes.Brand, err error) {
194	err = r.Session.DoRequest("SoftLayer_Brand", "getObject", nil, &r.Options, &resp)
195	return
196}
197
198// Retrieve
199func (r Brand) GetOpenTickets() (resp []datatypes.Ticket, err error) {
200	err = r.Session.DoRequest("SoftLayer_Brand", "getOpenTickets", nil, &r.Options, &resp)
201	return
202}
203
204// Retrieve Active accounts owned by the brand.
205func (r Brand) GetOwnedAccounts() (resp []datatypes.Account, err error) {
206	err = r.Session.DoRequest("SoftLayer_Brand", "getOwnedAccounts", nil, &r.Options, &resp)
207	return
208}
209
210// Retrieve
211func (r Brand) GetSecurityLevel() (resp datatypes.Security_Level, err error) {
212	err = r.Session.DoRequest("SoftLayer_Brand", "getSecurityLevel", nil, &r.Options, &resp)
213	return
214}
215
216// Retrieve
217func (r Brand) GetTicketGroups() (resp []datatypes.Ticket_Group, err error) {
218	err = r.Session.DoRequest("SoftLayer_Brand", "getTicketGroups", nil, &r.Options, &resp)
219	return
220}
221
222// Retrieve
223func (r Brand) GetTickets() (resp []datatypes.Ticket, err error) {
224	err = r.Session.DoRequest("SoftLayer_Brand", "getTickets", nil, &r.Options, &resp)
225	return
226}
227
228// no documentation yet
229func (r Brand) GetToken(userId *int) (resp string, err error) {
230	params := []interface{}{
231		userId,
232	}
233	err = r.Session.DoRequest("SoftLayer_Brand", "getToken", params, &r.Options, &resp)
234	return
235}
236
237// Retrieve
238func (r Brand) GetUsers() (resp []datatypes.User_Customer, err error) {
239	err = r.Session.DoRequest("SoftLayer_Brand", "getUsers", nil, &r.Options, &resp)
240	return
241}
242
243// Retrieve An account's associated virtual guest objects.
244func (r Brand) GetVirtualGuests() (resp []datatypes.Virtual_Guest, err error) {
245	err = r.Session.DoRequest("SoftLayer_Brand", "getVirtualGuests", nil, &r.Options, &resp)
246	return
247}
248
249// Contains business partner details associated with a brand. Country Enterprise Identifier (CEID), Channel ID, Segment ID and Reseller Level.
250type Brand_Business_Partner struct {
251	Session *session.Session
252	Options sl.Options
253}
254
255// GetBrandBusinessPartnerService returns an instance of the Brand_Business_Partner SoftLayer service
256func GetBrandBusinessPartnerService(sess *session.Session) Brand_Business_Partner {
257	return Brand_Business_Partner{Session: sess}
258}
259
260func (r Brand_Business_Partner) Id(id int) Brand_Business_Partner {
261	r.Options.Id = &id
262	return r
263}
264
265func (r Brand_Business_Partner) Mask(mask string) Brand_Business_Partner {
266	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
267		mask = fmt.Sprintf("mask[%s]", mask)
268	}
269
270	r.Options.Mask = mask
271	return r
272}
273
274func (r Brand_Business_Partner) Filter(filter string) Brand_Business_Partner {
275	r.Options.Filter = filter
276	return r
277}
278
279func (r Brand_Business_Partner) Limit(limit int) Brand_Business_Partner {
280	r.Options.Limit = &limit
281	return r
282}
283
284func (r Brand_Business_Partner) Offset(offset int) Brand_Business_Partner {
285	r.Options.Offset = &offset
286	return r
287}
288
289// Retrieve Brand associated with the business partner data
290func (r Brand_Business_Partner) GetBrand() (resp datatypes.Brand, err error) {
291	err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getBrand", nil, &r.Options, &resp)
292	return
293}
294
295// Retrieve Channel indicator used to categorize business partner revenue.
296func (r Brand_Business_Partner) GetChannel() (resp datatypes.Business_Partner_Channel, err error) {
297	err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getChannel", nil, &r.Options, &resp)
298	return
299}
300
301// no documentation yet
302func (r Brand_Business_Partner) GetObject() (resp datatypes.Brand_Business_Partner, err error) {
303	err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getObject", nil, &r.Options, &resp)
304	return
305}
306
307// Retrieve Segment indicator used to categorize business partner revenue.
308func (r Brand_Business_Partner) GetSegment() (resp datatypes.Business_Partner_Segment, err error) {
309	err = r.Session.DoRequest("SoftLayer_Brand_Business_Partner", "getSegment", nil, &r.Options, &resp)
310	return
311}
312
313// 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.
314type Brand_Restriction_Location_CustomerCountry struct {
315	Session *session.Session
316	Options sl.Options
317}
318
319// GetBrandRestrictionLocationCustomerCountryService returns an instance of the Brand_Restriction_Location_CustomerCountry SoftLayer service
320func GetBrandRestrictionLocationCustomerCountryService(sess *session.Session) Brand_Restriction_Location_CustomerCountry {
321	return Brand_Restriction_Location_CustomerCountry{Session: sess}
322}
323
324func (r Brand_Restriction_Location_CustomerCountry) Id(id int) Brand_Restriction_Location_CustomerCountry {
325	r.Options.Id = &id
326	return r
327}
328
329func (r Brand_Restriction_Location_CustomerCountry) Mask(mask string) Brand_Restriction_Location_CustomerCountry {
330	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
331		mask = fmt.Sprintf("mask[%s]", mask)
332	}
333
334	r.Options.Mask = mask
335	return r
336}
337
338func (r Brand_Restriction_Location_CustomerCountry) Filter(filter string) Brand_Restriction_Location_CustomerCountry {
339	r.Options.Filter = filter
340	return r
341}
342
343func (r Brand_Restriction_Location_CustomerCountry) Limit(limit int) Brand_Restriction_Location_CustomerCountry {
344	r.Options.Limit = &limit
345	return r
346}
347
348func (r Brand_Restriction_Location_CustomerCountry) Offset(offset int) Brand_Restriction_Location_CustomerCountry {
349	r.Options.Offset = &offset
350	return r
351}
352
353// no documentation yet
354func (r Brand_Restriction_Location_CustomerCountry) GetAllObjects() (resp []datatypes.Brand_Restriction_Location_CustomerCountry, err error) {
355	err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getAllObjects", nil, &r.Options, &resp)
356	return
357}
358
359// Retrieve This references the brand that has a brand-location-country restriction setup.
360func (r Brand_Restriction_Location_CustomerCountry) GetBrand() (resp datatypes.Brand, err error) {
361	err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getBrand", nil, &r.Options, &resp)
362	return
363}
364
365// 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.
366func (r Brand_Restriction_Location_CustomerCountry) GetLocation() (resp datatypes.Location, err error) {
367	err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getLocation", nil, &r.Options, &resp)
368	return
369}
370
371// no documentation yet
372func (r Brand_Restriction_Location_CustomerCountry) GetObject() (resp datatypes.Brand_Restriction_Location_CustomerCountry, err error) {
373	err = r.Session.DoRequest("SoftLayer_Brand_Restriction_Location_CustomerCountry", "getObject", nil, &r.Options, &resp)
374	return
375}
376