locale.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 // no documentation yet
26 type Locale struct {
27 Session session.SLSession
28 Options sl.Options
29 }
30
31 // GetLocaleService returns an instance of the Locale SoftLayer service
32 func GetLocaleService(sess session.SLSession) Locale {
33 return Locale{Session: sess}
34 }
35
36 func (r Locale) Id(id int) Locale {
37 r.Options.Id = &id
38 return r
39 }
40
41 func (r Locale) Mask(mask string) Locale {
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 Locale) Filter(filter string) Locale {
51 r.Options.Filter = filter
52 return r
53 }
54
55 func (r Locale) Limit(limit int) Locale {
56 r.Options.Limit = &limit
57 return r
58 }
59
60 func (r Locale) Offset(offset int) Locale {
61 r.Options.Offset = &offset
62 return r
63 }
64
65 // no documentation yet
66 func (r Locale) GetClosestToLanguageTag(languageTag *string) (resp datatypes.Locale, err error) {
67 params := []interface{}{
68 languageTag,
69 }
70 err = r.Session.DoRequest("SoftLayer_Locale", "getClosestToLanguageTag", params, &r.Options, &resp)
71 return
72 }
73
74 // no documentation yet
75 func (r Locale) GetObject() (resp datatypes.Locale, err error) {
76 err = r.Session.DoRequest("SoftLayer_Locale", "getObject", nil, &r.Options, &resp)
77 return
78 }
79
80 // no documentation yet
81 type Locale_Country struct {
82 Session session.SLSession
83 Options sl.Options
84 }
85
86 // GetLocaleCountryService returns an instance of the Locale_Country SoftLayer service
87 func GetLocaleCountryService(sess session.SLSession) Locale_Country {
88 return Locale_Country{Session: sess}
89 }
90
91 func (r Locale_Country) Id(id int) Locale_Country {
92 r.Options.Id = &id
93 return r
94 }
95
96 func (r Locale_Country) Mask(mask string) Locale_Country {
97 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
98 mask = fmt.Sprintf("mask[%s]", mask)
99 }
100
101 r.Options.Mask = mask
102 return r
103 }
104
105 func (r Locale_Country) Filter(filter string) Locale_Country {
106 r.Options.Filter = filter
107 return r
108 }
109
110 func (r Locale_Country) Limit(limit int) Locale_Country {
111 r.Options.Limit = &limit
112 return r
113 }
114
115 func (r Locale_Country) Offset(offset int) Locale_Country {
116 r.Options.Offset = &offset
117 return r
118 }
119
120 // This method is to get the collection of VAT country codes and VAT ID Regexes.
121 func (r Locale_Country) GetAllVatCountryCodesAndVatIdRegexes() (resp []datatypes.Container_Collection_Locale_VatCountryCodeAndFormat, err error) {
122 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getAllVatCountryCodesAndVatIdRegexes", nil, &r.Options, &resp)
123 return
124 }
125
126 // Use this method to retrieve a list of countries and locale information available to the current user.
127 func (r Locale_Country) GetAvailableCountries() (resp []datatypes.Locale_Country, err error) {
128 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getAvailableCountries", nil, &r.Options, &resp)
129 return
130 }
131
132 // Use this method to retrieve a list of countries and locale information such as country code and state/provinces.
133 func (r Locale_Country) GetCountries() (resp []datatypes.Locale_Country, err error) {
134 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getCountries", nil, &r.Options, &resp)
135 return
136 }
137
138 // This method will return a collection of [[SoftLayer_Container_Collection_Locale_CountryCode]] objects. If the country has states, a [[SoftLayer_Container_Collection_Locale_StateCode]] collection will be provided with the country.
139 func (r Locale_Country) GetCountriesAndStates(usFirstFlag *bool) (resp []datatypes.Container_Collection_Locale_CountryCode, err error) {
140 params := []interface{}{
141 usFirstFlag,
142 }
143 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getCountriesAndStates", params, &r.Options, &resp)
144 return
145 }
146
147 // no documentation yet
148 func (r Locale_Country) GetObject() (resp datatypes.Locale_Country, err error) {
149 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getObject", nil, &r.Options, &resp)
150 return
151 }
152
153 // This method will return an array of country codes that require postal code
154 func (r Locale_Country) GetPostalCodeRequiredCountryCodes() (resp []string, err error) {
155 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getPostalCodeRequiredCountryCodes", nil, &r.Options, &resp)
156 return
157 }
158
159 // Retrieve States that belong to this country.
160 func (r Locale_Country) GetStates() (resp []datatypes.Locale_StateProvince, err error) {
161 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getStates", nil, &r.Options, &resp)
162 return
163 }
164
165 // This method will return an array of ISO 3166 Alpha-2 country codes that use a Value-Added Tax (VAT) ID. Note the difference between [[SoftLayer_Locale_Country/getVatRequiredCountryCodes]] - this method will provide <strong>all</strong> country codes that use VAT ID, including those which are required.
166 func (r Locale_Country) GetVatCountries() (resp []string, err error) {
167 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getVatCountries", nil, &r.Options, &resp)
168 return
169 }
170
171 // This method will return an array of ISO 3166 Alpha-2 country codes that use a Value-Added Tax (VAT) ID. Note the difference between [[SoftLayer_Locale_Country/getVatCountries]] - this method will provide country codes where a VAT ID is required for onboarding to IBM Cloud.
172 func (r Locale_Country) GetVatRequiredCountryCodes() (resp []string, err error) {
173 err = r.Session.DoRequest("SoftLayer_Locale_Country", "getVatRequiredCountryCodes", nil, &r.Options, &resp)
174 return
175 }
176
177 // Returns true if the country code is in the European Union (EU), false otherwise.
178 func (r Locale_Country) IsEuropeanUnionCountry(iso2CountryCode *string) (resp bool, err error) {
179 params := []interface{}{
180 iso2CountryCode,
181 }
182 err = r.Session.DoRequest("SoftLayer_Locale_Country", "isEuropeanUnionCountry", params, &r.Options, &resp)
183 return
184 }
185
186 // Each User is assigned a timezone allowing for a precise local timestamp.
187 type Locale_Timezone struct {
188 Session session.SLSession
189 Options sl.Options
190 }
191
192 // GetLocaleTimezoneService returns an instance of the Locale_Timezone SoftLayer service
193 func GetLocaleTimezoneService(sess session.SLSession) Locale_Timezone {
194 return Locale_Timezone{Session: sess}
195 }
196
197 func (r Locale_Timezone) Id(id int) Locale_Timezone {
198 r.Options.Id = &id
199 return r
200 }
201
202 func (r Locale_Timezone) Mask(mask string) Locale_Timezone {
203 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
204 mask = fmt.Sprintf("mask[%s]", mask)
205 }
206
207 r.Options.Mask = mask
208 return r
209 }
210
211 func (r Locale_Timezone) Filter(filter string) Locale_Timezone {
212 r.Options.Filter = filter
213 return r
214 }
215
216 func (r Locale_Timezone) Limit(limit int) Locale_Timezone {
217 r.Options.Limit = &limit
218 return r
219 }
220
221 func (r Locale_Timezone) Offset(offset int) Locale_Timezone {
222 r.Options.Offset = &offset
223 return r
224 }
225
226 // Retrieve all timezone objects.
227 func (r Locale_Timezone) GetAllObjects() (resp []datatypes.Locale_Timezone, err error) {
228 err = r.Session.DoRequest("SoftLayer_Locale_Timezone", "getAllObjects", nil, &r.Options, &resp)
229 return
230 }
231
232 // getObject retrieves the SoftLayer_Locale_Timezone object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Locale_Timezone service.
233 func (r Locale_Timezone) GetObject() (resp datatypes.Locale_Timezone, err error) {
234 err = r.Session.DoRequest("SoftLayer_Locale_Timezone", "getObject", nil, &r.Options, &resp)
235 return
236 }
237