resource.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 Resource_Configuration struct {
27 Session session.SLSession
28 Options sl.Options
29 }
30
31 // GetResourceConfigurationService returns an instance of the Resource_Configuration SoftLayer service
32 func GetResourceConfigurationService(sess session.SLSession) Resource_Configuration {
33 return Resource_Configuration{Session: sess}
34 }
35
36 func (r Resource_Configuration) Id(id int) Resource_Configuration {
37 r.Options.Id = &id
38 return r
39 }
40
41 func (r Resource_Configuration) Mask(mask string) Resource_Configuration {
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 Resource_Configuration) Filter(filter string) Resource_Configuration {
51 r.Options.Filter = filter
52 return r
53 }
54
55 func (r Resource_Configuration) Limit(limit int) Resource_Configuration {
56 r.Options.Limit = &limit
57 return r
58 }
59
60 func (r Resource_Configuration) Offset(offset int) Resource_Configuration {
61 r.Options.Offset = &offset
62 return r
63 }
64
65 // The setOsPasswordFromEncrypted method is used to set the operating system password from a key/pair encrypted password signed by SoftLayer.
66 func (r Resource_Configuration) SetOsPasswordFromEncrypted(encryptedPassword *string) (resp bool, err error) {
67 params := []interface{}{
68 encryptedPassword,
69 }
70 err = r.Session.DoRequest("SoftLayer_Resource_Configuration", "setOsPasswordFromEncrypted", params, &r.Options, &resp)
71 return
72 }
73
74 // no documentation yet
75 type Resource_Group struct {
76 Session session.SLSession
77 Options sl.Options
78 }
79
80 // GetResourceGroupService returns an instance of the Resource_Group SoftLayer service
81 func GetResourceGroupService(sess session.SLSession) Resource_Group {
82 return Resource_Group{Session: sess}
83 }
84
85 func (r Resource_Group) Id(id int) Resource_Group {
86 r.Options.Id = &id
87 return r
88 }
89
90 func (r Resource_Group) Mask(mask string) Resource_Group {
91 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
92 mask = fmt.Sprintf("mask[%s]", mask)
93 }
94
95 r.Options.Mask = mask
96 return r
97 }
98
99 func (r Resource_Group) Filter(filter string) Resource_Group {
100 r.Options.Filter = filter
101 return r
102 }
103
104 func (r Resource_Group) Limit(limit int) Resource_Group {
105 r.Options.Limit = &limit
106 return r
107 }
108
109 func (r Resource_Group) Offset(offset int) Resource_Group {
110 r.Options.Offset = &offset
111 return r
112 }
113
114 // no documentation yet
115 func (r Resource_Group) EditObject(templateObject *datatypes.Resource_Group) (resp bool, err error) {
116 params := []interface{}{
117 templateObject,
118 }
119 err = r.Session.DoRequest("SoftLayer_Resource_Group", "editObject", params, &r.Options, &resp)
120 return
121 }
122
123 // Retrieve A resource group's associated group ancestors.
124 func (r Resource_Group) GetAncestorGroups() (resp []datatypes.Resource_Group, err error) {
125 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getAncestorGroups", nil, &r.Options, &resp)
126 return
127 }
128
129 // Retrieve A resource group's associated attributes.
130 func (r Resource_Group) GetAttributes() (resp []datatypes.Resource_Group_Attribute, err error) {
131 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getAttributes", nil, &r.Options, &resp)
132 return
133 }
134
135 // Retrieve A resource group's associated hardware members.
136 func (r Resource_Group) GetHardwareMembers() (resp []datatypes.Resource_Group_Member, err error) {
137 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getHardwareMembers", nil, &r.Options, &resp)
138 return
139 }
140
141 // Retrieve A resource group's associated members.
142 func (r Resource_Group) GetMembers() (resp []datatypes.Resource_Group_Member, err error) {
143 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getMembers", nil, &r.Options, &resp)
144 return
145 }
146
147 // no documentation yet
148 func (r Resource_Group) GetObject() (resp datatypes.Resource_Group, err error) {
149 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getObject", nil, &r.Options, &resp)
150 return
151 }
152
153 // Retrieve A resource group's associated root resource group.
154 func (r Resource_Group) GetRootResourceGroup() (resp datatypes.Resource_Group, err error) {
155 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getRootResourceGroup", nil, &r.Options, &resp)
156 return
157 }
158
159 // Retrieve A resource group's associated subnet members.
160 func (r Resource_Group) GetSubnetMembers() (resp []datatypes.Resource_Group_Member, err error) {
161 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getSubnetMembers", nil, &r.Options, &resp)
162 return
163 }
164
165 // Retrieve A resource group's associated template.
166 func (r Resource_Group) GetTemplate() (resp datatypes.Resource_Group_Template, err error) {
167 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getTemplate", nil, &r.Options, &resp)
168 return
169 }
170
171 // Retrieve A resource group's associated VLAN members.
172 func (r Resource_Group) GetVlanMembers() (resp []datatypes.Resource_Group_Member, err error) {
173 err = r.Session.DoRequest("SoftLayer_Resource_Group", "getVlanMembers", nil, &r.Options, &resp)
174 return
175 }
176
177 // no documentation yet
178 type Resource_Group_Template struct {
179 Session session.SLSession
180 Options sl.Options
181 }
182
183 // GetResourceGroupTemplateService returns an instance of the Resource_Group_Template SoftLayer service
184 func GetResourceGroupTemplateService(sess session.SLSession) Resource_Group_Template {
185 return Resource_Group_Template{Session: sess}
186 }
187
188 func (r Resource_Group_Template) Id(id int) Resource_Group_Template {
189 r.Options.Id = &id
190 return r
191 }
192
193 func (r Resource_Group_Template) Mask(mask string) Resource_Group_Template {
194 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
195 mask = fmt.Sprintf("mask[%s]", mask)
196 }
197
198 r.Options.Mask = mask
199 return r
200 }
201
202 func (r Resource_Group_Template) Filter(filter string) Resource_Group_Template {
203 r.Options.Filter = filter
204 return r
205 }
206
207 func (r Resource_Group_Template) Limit(limit int) Resource_Group_Template {
208 r.Options.Limit = &limit
209 return r
210 }
211
212 func (r Resource_Group_Template) Offset(offset int) Resource_Group_Template {
213 r.Options.Offset = &offset
214 return r
215 }
216
217 // no documentation yet
218 func (r Resource_Group_Template) GetAllObjects() (resp []datatypes.Resource_Group_Template, err error) {
219 err = r.Session.DoRequest("SoftLayer_Resource_Group_Template", "getAllObjects", nil, &r.Options, &resp)
220 return
221 }
222
223 // Retrieve
224 func (r Resource_Group_Template) GetChildren() (resp []datatypes.Resource_Group_Template, err error) {
225 err = r.Session.DoRequest("SoftLayer_Resource_Group_Template", "getChildren", nil, &r.Options, &resp)
226 return
227 }
228
229 // Retrieve
230 func (r Resource_Group_Template) GetMembers() (resp []datatypes.Resource_Group_Template_Member, err error) {
231 err = r.Session.DoRequest("SoftLayer_Resource_Group_Template", "getMembers", nil, &r.Options, &resp)
232 return
233 }
234
235 // no documentation yet
236 func (r Resource_Group_Template) GetObject() (resp datatypes.Resource_Group_Template, err error) {
237 err = r.Session.DoRequest("SoftLayer_Resource_Group_Template", "getObject", nil, &r.Options, &resp)
238 return
239 }
240
241 // no documentation yet
242 type Resource_Metadata struct {
243 Session session.SLSession
244 Options sl.Options
245 }
246
247 // GetResourceMetadataService returns an instance of the Resource_Metadata SoftLayer service
248 func GetResourceMetadataService(sess session.SLSession) Resource_Metadata {
249 return Resource_Metadata{Session: sess}
250 }
251
252 func (r Resource_Metadata) Id(id int) Resource_Metadata {
253 r.Options.Id = &id
254 return r
255 }
256
257 func (r Resource_Metadata) Mask(mask string) Resource_Metadata {
258 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
259 mask = fmt.Sprintf("mask[%s]", mask)
260 }
261
262 r.Options.Mask = mask
263 return r
264 }
265
266 func (r Resource_Metadata) Filter(filter string) Resource_Metadata {
267 r.Options.Filter = filter
268 return r
269 }
270
271 func (r Resource_Metadata) Limit(limit int) Resource_Metadata {
272 r.Options.Limit = &limit
273 return r
274 }
275
276 func (r Resource_Metadata) Offset(offset int) Resource_Metadata {
277 r.Options.Offset = &offset
278 return r
279 }
280
281 // The getAccountId retrieves the ID for the account on which the resource is located.
282 func (r Resource_Metadata) GetAccountId() (resp int, err error) {
283 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getAccountId", nil, &r.Options, &resp)
284 return
285 }
286
287 // The getBackendMacAddresses method retrieves a list of backend MAC addresses for the resource
288 func (r Resource_Metadata) GetBackendMacAddresses() (resp []string, err error) {
289 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getBackendMacAddresses", nil, &r.Options, &resp)
290 return
291 }
292
293 // The getDatacenter method retrieves the name of the datacenter in which the resource is located.
294 func (r Resource_Metadata) GetDatacenter() (resp string, err error) {
295 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getDatacenter", nil, &r.Options, &resp)
296 return
297 }
298
299 // The getDatacenterId retrieves the ID for the datacenter in which the resource is located.
300 func (r Resource_Metadata) GetDatacenterId() (resp int, err error) {
301 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getDatacenterId", nil, &r.Options, &resp)
302 return
303 }
304
305 // The getDomain method retrieves the hostname for the resource.
306 func (r Resource_Metadata) GetDomain() (resp string, err error) {
307 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getDomain", nil, &r.Options, &resp)
308 return
309 }
310
311 // The getFrontendMacAddresses method retrieves a list of frontend MAC addresses for the resource
312 func (r Resource_Metadata) GetFrontendMacAddresses() (resp []string, err error) {
313 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getFrontendMacAddresses", nil, &r.Options, &resp)
314 return
315 }
316
317 // The getFullyQualifiedDomainName method provides the user with a combined return which includes the hostname and domain for the resource. Because this method returns multiple pieces of information, it avoids the need to use multiple methods to return the desired information.
318 func (r Resource_Metadata) GetFullyQualifiedDomainName() (resp string, err error) {
319 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getFullyQualifiedDomainName", nil, &r.Options, &resp)
320 return
321 }
322
323 // The getId getGlobalIdentifier retrieves the globalIdentifier for the resource
324 func (r Resource_Metadata) GetGlobalIdentifier() (resp string, err error) {
325 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getGlobalIdentifier", nil, &r.Options, &resp)
326 return
327 }
328
329 // The getHostname method retrieves the hostname for the resource.
330 func (r Resource_Metadata) GetHostname() (resp string, err error) {
331 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getHostname", nil, &r.Options, &resp)
332 return
333 }
334
335 // The getId method retrieves the ID for the resource
336 func (r Resource_Metadata) GetId() (resp int, err error) {
337 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getId", nil, &r.Options, &resp)
338 return
339 }
340
341 // The getPrimaryBackendIpAddress method retrieves the primary backend IP address for the resource
342 func (r Resource_Metadata) GetPrimaryBackendIpAddress() (resp string, err error) {
343 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getPrimaryBackendIpAddress", nil, &r.Options, &resp)
344 return
345 }
346
347 // The getPrimaryIpAddress method retrieves the primary IP address for the resource. For resources with a frontend network, the frontend IP address will be returned. For resources that have been provisioned with only a backend network, the backend IP address will be returned, as a frontend address will not exist.
348 func (r Resource_Metadata) GetPrimaryIpAddress() (resp string, err error) {
349 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getPrimaryIpAddress", nil, &r.Options, &resp)
350 return
351 }
352
353 // The getProvisionState method retrieves the provision state of the resource. The provision state may be used to determine when it is considered safe to perform additional setup operations. The method returns 'PROCESSING' to indicate the provision is in progress and 'COMPLETE' when the provision is complete.
354 func (r Resource_Metadata) GetProvisionState() (resp string, err error) {
355 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getProvisionState", nil, &r.Options, &resp)
356 return
357 }
358
359 // The getRouter method will return the router associated with a network component. When the router is redundant, the hostname of the redundant group will be returned, rather than the router hostname.
360 func (r Resource_Metadata) GetRouter(macAddress *string) (resp string, err error) {
361 params := []interface{}{
362 macAddress,
363 }
364 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getRouter", params, &r.Options, &resp)
365 return
366 }
367
368 // The getServiceResource method retrieves a specific service resource associated with the resource. Service resources are additional resources that may be used by this resource.
369 func (r Resource_Metadata) GetServiceResource(serviceName *string, index *int) (resp string, err error) {
370 params := []interface{}{
371 serviceName,
372 index,
373 }
374 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getServiceResource", params, &r.Options, &resp)
375 return
376 }
377
378 // The getServiceResources method retrieves all service resources associated with the resource. Service resources are additional resources that may be used by this resource. The output format is <type>=<address> for each service resource.
379 func (r Resource_Metadata) GetServiceResources() (resp []datatypes.Container_Resource_Metadata_ServiceResource, err error) {
380 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getServiceResources", nil, &r.Options, &resp)
381 return
382 }
383
384 // The getTags method retrieves all tags associated with the resource. Tags are single keywords assigned to a resource that assist the user in identifying the resource and its roles when performing a simple search. Tags are assigned by any user with access to the resource.
385 func (r Resource_Metadata) GetTags() (resp []string, err error) {
386 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getTags", nil, &r.Options, &resp)
387 return
388 }
389
390 // The getUserMetadata method retrieves metadata completed by users who interact with the resource. Metadata gathered using this method is unique to parameters set using the ”'setUserMetadata”' method, which must be executed prior to completing this method. User metadata may also be provided while placing an order for a resource.
391 func (r Resource_Metadata) GetUserMetadata() (resp string, err error) {
392 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getUserMetadata", nil, &r.Options, &resp)
393 return
394 }
395
396 // The getVlanIds method returns a list of VLAN IDs for the network component matching the provided MAC address associated with the resource. For each return, the native VLAN will appear first, followed by any trunked VLANs associated with the network component.
397 func (r Resource_Metadata) GetVlanIds(macAddress *string) (resp []int, err error) {
398 params := []interface{}{
399 macAddress,
400 }
401 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getVlanIds", params, &r.Options, &resp)
402 return
403 }
404
405 // The getVlans method returns a list of VLAN numbers for the network component matching the provided MAC address associated with the resource. For each return, the native VLAN will appear first, followed by any trunked VLANs associated with the network component.
406 func (r Resource_Metadata) GetVlans(macAddress *string) (resp []int, err error) {
407 params := []interface{}{
408 macAddress,
409 }
410 err = r.Session.DoRequest("SoftLayer_Resource_Metadata", "getVlans", params, &r.Options, &resp)
411 return
412 }
413