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_Dns_Domain data type represents a single DNS domain record hosted on the SoftLayer nameservers. Domains contain general information about the domain name such as name and serial. Individual records such as A, AAAA, CTYPE, and MX records are stored in the domain's associated [[SoftLayer_Dns_Domain_ResourceRecord (type)|SoftLayer_Dns_Domain_ResourceRecord]] records.
26 type Dns_Domain struct {
27 Session session.SLSession
28 Options sl.Options
29 }
30 31 // GetDnsDomainService returns an instance of the Dns_Domain SoftLayer service
32 func GetDnsDomainService(sess session.SLSession) Dns_Domain {
33 return Dns_Domain{Session: sess}
34 }
35 36 func (r Dns_Domain) Id(id int) Dns_Domain {
37 r.Options.Id = &id
38 return r
39 }
40 41 func (r Dns_Domain) Mask(mask string) Dns_Domain {
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 Dns_Domain) Filter(filter string) Dns_Domain {
51 r.Options.Filter = filter
52 return r
53 }
54 55 func (r Dns_Domain) Limit(limit int) Dns_Domain {
56 r.Options.Limit = &limit
57 return r
58 }
59 60 func (r Dns_Domain) Offset(offset int) Dns_Domain {
61 r.Options.Offset = &offset
62 return r
63 }
64 65 // Create an A record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. createARecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_AType.
66 func (r Dns_Domain) CreateARecord(host *string, data *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord_AType, err error) {
67 params := []interface{}{
68 host,
69 data,
70 ttl,
71 }
72 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createARecord", params, &r.Options, &resp)
73 return
74 }
75 76 // Create an AAAA record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. createARecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_AaaaType.
77 func (r Dns_Domain) CreateAaaaRecord(host *string, data *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord_AaaaType, err error) {
78 params := []interface{}{
79 host,
80 data,
81 ttl,
82 }
83 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createAaaaRecord", params, &r.Options, &resp)
84 return
85 }
86 87 // Create a CNAME record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. createCnameRecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_CnameType.
88 func (r Dns_Domain) CreateCnameRecord(host *string, data *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord_CnameType, err error) {
89 params := []interface{}{
90 host,
91 data,
92 ttl,
93 }
94 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createCnameRecord", params, &r.Options, &resp)
95 return
96 }
97 98 // Create an MX record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. MX records are created with a default priority of 10. createMxRecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_MxType.
99 func (r Dns_Domain) CreateMxRecord(host *string, data *string, ttl *int, mxPriority *int) (resp datatypes.Dns_Domain_ResourceRecord_MxType, err error) {
100 params := []interface{}{
101 host,
102 data,
103 ttl,
104 mxPriority,
105 }
106 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createMxRecord", params, &r.Options, &resp)
107 return
108 }
109 110 // Create an NS record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. createNsRecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_NsType.
111 func (r Dns_Domain) CreateNsRecord(host *string, data *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord_NsType, err error) {
112 params := []interface{}{
113 host,
114 data,
115 ttl,
116 }
117 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createNsRecord", params, &r.Options, &resp)
118 return
119 }
120 121 // Create a new domain on the SoftLayer name servers. The SoftLayer_Dns_Domain object passed to this function must have at least one A or AAAA resource record.
122 //
123 // createObject creates a default SOA record with the data:
124 // * ”'host”': "@"
125 // * ”'data”': "ns1.softlayer.com."
126 // * ”'responsible person”': "root.[your domain name]."
127 // * ”'expire”': 604800 seconds
128 // * ”'refresh”': 3600 seconds
129 // * ”'retry”': 300 seconds
130 // * ”'minimum”': 3600 seconds
131 //
132 // If your new domain uses the .de top-level domain then SOA refresh is set to 10000 seconds, retry is set to 1800 seconds, and minimum to 10000 seconds.
133 //
134 // If your domain doesn't contain NS resource records for ns1.softlayer.com or ns2.softlayer.com then ”createObject” will create them for you.
135 //
136 // ”createObject” returns a Boolean ”true” on successful object creation or ”false” if your domain was unable to be created..
137 func (r Dns_Domain) CreateObject(templateObject *datatypes.Dns_Domain) (resp datatypes.Dns_Domain, err error) {
138 params := []interface{}{
139 templateObject,
140 }
141 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createObject", params, &r.Options, &resp)
142 return
143 }
144 145 // Create multiple domains on the SoftLayer name servers. Each domain record passed to ”createObjects” follows the logic in the SoftLayer_Dns_Domain ”createObject” method.
146 func (r Dns_Domain) CreateObjects(templateObjects []datatypes.Dns_Domain) (resp []datatypes.Dns_Domain, err error) {
147 params := []interface{}{
148 templateObjects,
149 }
150 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createObjects", params, &r.Options, &resp)
151 return
152 }
153 154 // setPtrRecordForIpAddress() sets a single reverse DNS record for a single IP address and returns the newly created or edited [[SoftLayer_Dns_Domain_ResourceRecord]] record. Currently this method only supports IPv4 addresses and performs no operation when given an IPv6 address.
155 func (r Dns_Domain) CreatePtrRecord(ipAddress *string, ptrRecord *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord, err error) {
156 params := []interface{}{
157 ipAddress,
158 ptrRecord,
159 ttl,
160 }
161 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createPtrRecord", params, &r.Options, &resp)
162 return
163 }
164 165 // Create an SPF record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. createARecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_SpfType.
166 func (r Dns_Domain) CreateSpfRecord(host *string, data *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord_SpfType, err error) {
167 params := []interface{}{
168 host,
169 data,
170 ttl,
171 }
172 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createSpfRecord", params, &r.Options, &resp)
173 return
174 }
175 176 // Create a TXT record on a SoftLayer domain. This is a shortcut method, meant to take the work out of creating a SoftLayer_Dns_Domain_ResourceRecord if you already have a domain record available. createARecord returns the newly created SoftLayer_Dns_Domain_ResourceRecord_TxtType.
177 func (r Dns_Domain) CreateTxtRecord(host *string, data *string, ttl *int) (resp datatypes.Dns_Domain_ResourceRecord_TxtType, err error) {
178 params := []interface{}{
179 host,
180 data,
181 ttl,
182 }
183 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "createTxtRecord", params, &r.Options, &resp)
184 return
185 }
186 187 // deleteObject permanently removes a domain and all of it's associated resource records from the softlayer name servers. ”'This cannot be undone.”' Be wary of running this method. If you remove a domain in error you will need to re-create it by creating a new SoftLayer_Dns_Domain object.
188 func (r Dns_Domain) DeleteObject() (resp bool, err error) {
189 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "deleteObject", nil, &r.Options, &resp)
190 return
191 }
192 193 // Retrieve The SoftLayer customer account that owns a domain.
194 func (r Dns_Domain) GetAccount() (resp datatypes.Account, err error) {
195 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getAccount", nil, &r.Options, &resp)
196 return
197 }
198 199 // Search for [[SoftLayer_Dns_Domain]] records by domain name. getByDomainName() performs an inclusive search for domain records, returning multiple records based on partial name matches. Use this method to locate domain records if you don't have access to their id numbers.
200 func (r Dns_Domain) GetByDomainName(name *string) (resp []datatypes.Dns_Domain, err error) {
201 params := []interface{}{
202 name,
203 }
204 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getByDomainName", params, &r.Options, &resp)
205 return
206 }
207 208 // Retrieve A flag indicating that the dns domain record is a managed resource.
209 func (r Dns_Domain) GetManagedResourceFlag() (resp bool, err error) {
210 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getManagedResourceFlag", nil, &r.Options, &resp)
211 return
212 }
213 214 // getObject retrieves the SoftLayer_Dns_Domain object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Dns_Domain service. You can only retrieve domains that are assigned to your SoftLayer account.
215 func (r Dns_Domain) GetObject() (resp datatypes.Dns_Domain, err error) {
216 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getObject", nil, &r.Options, &resp)
217 return
218 }
219 220 // Retrieve The individual records contained within a domain record. These include but are not limited to A, AAAA, MX, CTYPE, SPF and TXT records.
221 func (r Dns_Domain) GetResourceRecords() (resp []datatypes.Dns_Domain_ResourceRecord, err error) {
222 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getResourceRecords", nil, &r.Options, &resp)
223 return
224 }
225 226 // Retrieve The secondary DNS record that defines this domain as being managed through zone transfers.
227 func (r Dns_Domain) GetSecondary() (resp datatypes.Dns_Secondary, err error) {
228 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getSecondary", nil, &r.Options, &resp)
229 return
230 }
231 232 // Retrieve The start of authority (SOA) record contains authoritative and propagation details for a DNS zone. This property is not considered in requests to createObject and editObject.
233 func (r Dns_Domain) GetSoaResourceRecord() (resp datatypes.Dns_Domain_ResourceRecord_SoaType, err error) {
234 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getSoaResourceRecord", nil, &r.Options, &resp)
235 return
236 }
237 238 // Return a SoftLayer hosted domain and resource records' data formatted as zone file.
239 func (r Dns_Domain) GetZoneFileContents() (resp string, err error) {
240 err = r.Session.DoRequest("SoftLayer_Dns_Domain", "getZoneFileContents", nil, &r.Options, &resp)
241 return
242 }
243 244 // The SoftLayer_Dns_Domain_ResourceRecord data type represents a single resource record entry in a SoftLayer hosted domain. Each resource record contains a ”host” and ”data” property, defining a resource's name and it's target data. Domains contain multiple types of resource records. The ”type” property separates out resource records by type. ”Type” can take one of the following values:
245 // * ”'"a"”' for [[SoftLayer_Dns_Domain_ResourceRecord_AType|address]] records
246 // * ”'"aaaa"”' for [[SoftLayer_Dns_Domain_ResourceRecord_AaaaType|address]] records
247 // * ”'"cname"”' for [[SoftLayer_Dns_Domain_ResourceRecord_CnameType|canonical name]] records
248 // * ”'"mx"”' for [[SoftLayer_Dns_Domain_ResourceRecord_MxType|mail exchanger]] records
249 // * ”'"ns"”' for [[SoftLayer_Dns_Domain_ResourceRecord_NsType|name server]] records
250 // * ”'"ptr"”' for [[SoftLayer_Dns_Domain_ResourceRecord_PtrType|pointer]] records in reverse domains
251 // * ”'"soa"”' for a domain's [[SoftLayer_Dns_Domain_ResourceRecord_SoaType|start of authority]] record
252 // * ”'"spf"”' for [[SoftLayer_Dns_Domain_ResourceRecord_SpfType|sender policy framework]] records
253 // * ”'"srv"”' for [[SoftLayer_Dns_Domain_ResourceRecord_SrvType|service]] records
254 // * ”'"txt"”' for [[SoftLayer_Dns_Domain_ResourceRecord_TxtType|text]] records
255 //
256 // As ”SoftLayer_Dns_Domain_ResourceRecord” objects are created and loaded, the API verifies the ”type” property and casts the object as the appropriate type.
257 type Dns_Domain_ResourceRecord struct {
258 Session session.SLSession
259 Options sl.Options
260 }
261 262 // GetDnsDomainResourceRecordService returns an instance of the Dns_Domain_ResourceRecord SoftLayer service
263 func GetDnsDomainResourceRecordService(sess session.SLSession) Dns_Domain_ResourceRecord {
264 return Dns_Domain_ResourceRecord{Session: sess}
265 }
266 267 func (r Dns_Domain_ResourceRecord) Id(id int) Dns_Domain_ResourceRecord {
268 r.Options.Id = &id
269 return r
270 }
271 272 func (r Dns_Domain_ResourceRecord) Mask(mask string) Dns_Domain_ResourceRecord {
273 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
274 mask = fmt.Sprintf("mask[%s]", mask)
275 }
276 277 r.Options.Mask = mask
278 return r
279 }
280 281 func (r Dns_Domain_ResourceRecord) Filter(filter string) Dns_Domain_ResourceRecord {
282 r.Options.Filter = filter
283 return r
284 }
285 286 func (r Dns_Domain_ResourceRecord) Limit(limit int) Dns_Domain_ResourceRecord {
287 r.Options.Limit = &limit
288 return r
289 }
290 291 func (r Dns_Domain_ResourceRecord) Offset(offset int) Dns_Domain_ResourceRecord {
292 r.Options.Offset = &offset
293 return r
294 }
295 296 // createObject creates a new domain resource record. The ”host” property of the templateObject parameter is scrubbed to remove all non-alpha numeric characters except for "@", "_", ".", "*", and "-". The ”data” property of the templateObject parameter is scrubbed to remove all non-alphanumeric characters for "." and "-". Creating a resource record updates the serial number of the domain the resource record is associated with.
297 //
298 // ”createObject” returns Boolean ”true” on successful create or ”false” if it was unable to create a resource record.
299 func (r Dns_Domain_ResourceRecord) CreateObject(templateObject *datatypes.Dns_Domain_ResourceRecord) (resp datatypes.Dns_Domain_ResourceRecord, err error) {
300 params := []interface{}{
301 templateObject,
302 }
303 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "createObject", params, &r.Options, &resp)
304 return
305 }
306 307 // Create multiple resource records on a domain. This follows the same logic as ”createObject'. The serial number of the domain associated with this resource record is updated upon creation.
308 //
309 // ”createObjects” returns Boolean ”true” on successful creation or ”false” if it was unable to create a resource record.
310 func (r Dns_Domain_ResourceRecord) CreateObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord) (resp []datatypes.Dns_Domain_ResourceRecord, err error) {
311 params := []interface{}{
312 templateObjects,
313 }
314 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "createObjects", params, &r.Options, &resp)
315 return
316 }
317 318 // Delete a domain's resource record. ”'This cannot be undone.”' Be wary of running this method. If you remove a resource record in error you will need to re-create it by creating a new SoftLayer_Dns_Domain_ResourceRecord object. The serial number of the domain associated with this resource record is updated upon deletion. You may not delete SOA, NS, or PTR resource records.
319 //
320 // ”deleteObject” returns Boolean ”true” on successful deletion or ”false” if it was unable to remove a resource record.
321 func (r Dns_Domain_ResourceRecord) DeleteObject() (resp bool, err error) {
322 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "deleteObject", nil, &r.Options, &resp)
323 return
324 }
325 326 // Remove multiple resource records from a domain. This follows the same logic as ”deleteObject” and ”'cannot be undone”'. The serial number of the domain associated with this resource record is updated upon deletion. You may not delete SOA records, PTR records, or NS resource records that point to ns1.softlayer.com or ns2.softlayer.com.
327 //
328 // ”deleteObjects” returns Boolean ”true” on successful deletion or ”false” if it was unable to remove a resource record.
329 func (r Dns_Domain_ResourceRecord) DeleteObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord) (resp bool, err error) {
330 params := []interface{}{
331 templateObjects,
332 }
333 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "deleteObjects", params, &r.Options, &resp)
334 return
335 }
336 337 // editObject edits an existing domain resource record. The ”host” property of the templateObject parameter is scrubbed to remove all non-alpha numeric characters except for "@", "_", ".", "*", and "-". The ”data” property of the templateObject parameter is scrubbed to remove all non-alphanumeric characters for "." and "-". Editing a resource record updates the serial number of the domain the resource record is associated with.
338 //
339 // ”editObject” returns Boolean ”true” on a successful edit or ”false” if it was unable to edit the resource record.
340 func (r Dns_Domain_ResourceRecord) EditObject(templateObject *datatypes.Dns_Domain_ResourceRecord) (resp bool, err error) {
341 params := []interface{}{
342 templateObject,
343 }
344 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "editObject", params, &r.Options, &resp)
345 return
346 }
347 348 // Edit multiple resource records on a domain. This follows the same logic as ”createObject'. The serial number of the domain associated with this resource record is updated upon creation.
349 //
350 // ”createObjects” returns Boolean ”true” on successful creation or ”false” if it was unable to create a resource record.
351 func (r Dns_Domain_ResourceRecord) EditObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord) (resp bool, err error) {
352 params := []interface{}{
353 templateObjects,
354 }
355 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "editObjects", params, &r.Options, &resp)
356 return
357 }
358 359 // Retrieve The domain that a resource record belongs to.
360 func (r Dns_Domain_ResourceRecord) GetDomain() (resp datatypes.Dns_Domain, err error) {
361 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "getDomain", nil, &r.Options, &resp)
362 return
363 }
364 365 // getObject retrieves the SoftLayer_Dns_Domain_ResourceRecord object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Dns_Domain_ResourceRecord service. You can only retrieve resource records belonging to domains that are assigned to your SoftLayer account.
366 func (r Dns_Domain_ResourceRecord) GetObject() (resp datatypes.Dns_Domain_ResourceRecord, err error) {
367 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord", "getObject", nil, &r.Options, &resp)
368 return
369 }
370 371 // SoftLayer_Dns_Domain_ResourceRecord_MxType is a SoftLayer_Dns_Domain_ResourceRecord object whose ”type” property is set to "mx" and used to describe MX resource records. MX records control which hosts are responsible as mail exchangers for a domain. For instance, in the domain example.org, an MX record whose host is "@" and data is "mail" says that the host "mail.example.org" is responsible for handling mail for example.org. That means mail sent to users @example.org are delivered to mail.example.org.
372 //
373 // Domains can have more than one MX record if it uses more than one server to send mail through. Multiple MX records are denoted by their priority, defined by the mxPriority property.
374 //
375 // MX records must be defined for hosts with accompanying A or AAAA resource records. They may not point mail towards a host defined by a CNAME record.
376 type Dns_Domain_ResourceRecord_MxType struct {
377 Session session.SLSession
378 Options sl.Options
379 }
380 381 // GetDnsDomainResourceRecordMxTypeService returns an instance of the Dns_Domain_ResourceRecord_MxType SoftLayer service
382 func GetDnsDomainResourceRecordMxTypeService(sess session.SLSession) Dns_Domain_ResourceRecord_MxType {
383 return Dns_Domain_ResourceRecord_MxType{Session: sess}
384 }
385 386 func (r Dns_Domain_ResourceRecord_MxType) Id(id int) Dns_Domain_ResourceRecord_MxType {
387 r.Options.Id = &id
388 return r
389 }
390 391 func (r Dns_Domain_ResourceRecord_MxType) Mask(mask string) Dns_Domain_ResourceRecord_MxType {
392 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
393 mask = fmt.Sprintf("mask[%s]", mask)
394 }
395 396 r.Options.Mask = mask
397 return r
398 }
399 400 func (r Dns_Domain_ResourceRecord_MxType) Filter(filter string) Dns_Domain_ResourceRecord_MxType {
401 r.Options.Filter = filter
402 return r
403 }
404 405 func (r Dns_Domain_ResourceRecord_MxType) Limit(limit int) Dns_Domain_ResourceRecord_MxType {
406 r.Options.Limit = &limit
407 return r
408 }
409 410 func (r Dns_Domain_ResourceRecord_MxType) Offset(offset int) Dns_Domain_ResourceRecord_MxType {
411 r.Options.Offset = &offset
412 return r
413 }
414 415 // createObject creates a new MX record. The ”host” property of the templateObject parameter is scrubbed to remove all non-alpha numeric characters except for "@", "_", ".", "*", and "-". The ”data” property of the templateObject parameter is scrubbed to remove all non-alphanumeric characters for "." and "-". Creating an MX record updates the serial number of the domain the resource record is associated with.
416 func (r Dns_Domain_ResourceRecord_MxType) CreateObject(templateObject *datatypes.Dns_Domain_ResourceRecord_MxType) (resp datatypes.Dns_Domain_ResourceRecord_MxType, err error) {
417 params := []interface{}{
418 templateObject,
419 }
420 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "createObject", params, &r.Options, &resp)
421 return
422 }
423 424 // Create multiple MX records on a domain. This follows the same logic as ”createObject'. The serial number of the domain associated with this MX record is updated upon creation.
425 //
426 // ”createObjects” returns Boolean ”true” on successful creation or ”false” if it was unable to create a resource record.
427 func (r Dns_Domain_ResourceRecord_MxType) CreateObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord) (resp []datatypes.Dns_Domain_ResourceRecord, err error) {
428 params := []interface{}{
429 templateObjects,
430 }
431 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "createObjects", params, &r.Options, &resp)
432 return
433 }
434 435 // Delete a domain's MX record. ”'This cannot be undone.”' Be wary of running this method. If you remove a resource record in error you will need to re-create it by creating a new SoftLayer_Dns_Domain_ResourceRecord_MxType object. The serial number of the domain associated with this MX record is updated upon deletion.
436 //
437 // ”deleteObject” returns Boolean ”true” on successful deletion or ”false” if it was unable to remove a resource record.
438 func (r Dns_Domain_ResourceRecord_MxType) DeleteObject() (resp bool, err error) {
439 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "deleteObject", nil, &r.Options, &resp)
440 return
441 }
442 443 // Remove multiple MX records from a domain. This follows the same logic as ”deleteObject” and ”'cannot be undone”'. The serial number of the domain associated with this MX record is updated upon deletion.
444 //
445 // ”deleteObjects” returns Boolean ”true” on successful deletion or ”false” if it was unable to remove a resource record.
446 func (r Dns_Domain_ResourceRecord_MxType) DeleteObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord_MxType) (resp bool, err error) {
447 params := []interface{}{
448 templateObjects,
449 }
450 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "deleteObjects", params, &r.Options, &resp)
451 return
452 }
453 454 // editObject edits an existing MX resource record. The ”host” property of the templateObject parameter is scrubbed to remove all non-alpha numeric characters except for "@", "_", ".", "*", and "-". The ”data” property of the templateObject parameter is scrubbed to remove all non-alphanumeric characters for "." and "-". Editing an MX record updates the serial number of the domain the record is associated with.
455 //
456 // ”editObject” returns Boolean ”true” on a successful edit or ”false” if it was unable to edit the resource record.
457 func (r Dns_Domain_ResourceRecord_MxType) EditObject(templateObject *datatypes.Dns_Domain_ResourceRecord_MxType) (resp bool, err error) {
458 params := []interface{}{
459 templateObject,
460 }
461 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "editObject", params, &r.Options, &resp)
462 return
463 }
464 465 // Edit multiple MX records on a domain. This follows the same logic as ”createObject'. The serial number of the domain associated with this MX record is updated upon creation.
466 //
467 // ”createObjects” returns Boolean ”true” on successful creation or ”false” if it was unable to create a resource record.
468 func (r Dns_Domain_ResourceRecord_MxType) EditObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord_MxType) (resp bool, err error) {
469 params := []interface{}{
470 templateObjects,
471 }
472 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "editObjects", params, &r.Options, &resp)
473 return
474 }
475 476 // Retrieve The domain that a resource record belongs to.
477 func (r Dns_Domain_ResourceRecord_MxType) GetDomain() (resp datatypes.Dns_Domain, err error) {
478 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "getDomain", nil, &r.Options, &resp)
479 return
480 }
481 482 // getObject retrieves the SoftLayer_Dns_Domain_ResourceRecord_MxType object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Dns_Domain_ResourceRecord_MxType service. You can only retrieve resource records belonging to domains that are assigned to your SoftLayer account.
483 func (r Dns_Domain_ResourceRecord_MxType) GetObject() (resp datatypes.Dns_Domain_ResourceRecord_MxType, err error) {
484 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_MxType", "getObject", nil, &r.Options, &resp)
485 return
486 }
487 488 // SoftLayer_Dns_Domain_ResourceRecord_SrvType is a SoftLayer_Dns_Domain_ResourceRecord object whose ”type” property is set to "srv" and defines a DNS SRV record on a SoftLayer hosted domain.
489 type Dns_Domain_ResourceRecord_SrvType struct {
490 Session session.SLSession
491 Options sl.Options
492 }
493 494 // GetDnsDomainResourceRecordSrvTypeService returns an instance of the Dns_Domain_ResourceRecord_SrvType SoftLayer service
495 func GetDnsDomainResourceRecordSrvTypeService(sess session.SLSession) Dns_Domain_ResourceRecord_SrvType {
496 return Dns_Domain_ResourceRecord_SrvType{Session: sess}
497 }
498 499 func (r Dns_Domain_ResourceRecord_SrvType) Id(id int) Dns_Domain_ResourceRecord_SrvType {
500 r.Options.Id = &id
501 return r
502 }
503 504 func (r Dns_Domain_ResourceRecord_SrvType) Mask(mask string) Dns_Domain_ResourceRecord_SrvType {
505 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
506 mask = fmt.Sprintf("mask[%s]", mask)
507 }
508 509 r.Options.Mask = mask
510 return r
511 }
512 513 func (r Dns_Domain_ResourceRecord_SrvType) Filter(filter string) Dns_Domain_ResourceRecord_SrvType {
514 r.Options.Filter = filter
515 return r
516 }
517 518 func (r Dns_Domain_ResourceRecord_SrvType) Limit(limit int) Dns_Domain_ResourceRecord_SrvType {
519 r.Options.Limit = &limit
520 return r
521 }
522 523 func (r Dns_Domain_ResourceRecord_SrvType) Offset(offset int) Dns_Domain_ResourceRecord_SrvType {
524 r.Options.Offset = &offset
525 return r
526 }
527 528 // createObject creates a new SRV record. The ”host” property of the templateObject parameter is scrubbed to remove all non-alpha numeric characters except for "@", "_", ".", "*", and "-". The ”data” property of the templateObject parameter is scrubbed to remove all non-alphanumeric characters for "." and "-". Creating an SRV record updates the serial number of the domain the resource record is associated with.
529 func (r Dns_Domain_ResourceRecord_SrvType) CreateObject(templateObject *datatypes.Dns_Domain_ResourceRecord_SrvType) (resp datatypes.Dns_Domain_ResourceRecord_SrvType, err error) {
530 params := []interface{}{
531 templateObject,
532 }
533 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "createObject", params, &r.Options, &resp)
534 return
535 }
536 537 // Create multiple SRV records on a domain. This follows the same logic as ”createObject'. The serial number of the domain associated with this SRV record is updated upon creation.
538 //
539 // ”createObjects” returns Boolean ”true” on successful creation or ”false” if it was unable to create a resource record.
540 func (r Dns_Domain_ResourceRecord_SrvType) CreateObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord) (resp []datatypes.Dns_Domain_ResourceRecord, err error) {
541 params := []interface{}{
542 templateObjects,
543 }
544 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "createObjects", params, &r.Options, &resp)
545 return
546 }
547 548 // Delete a domain's SRV record. ”'This cannot be undone.”' Be wary of running this method. If you remove a resource record in error you will need to re-create it by creating a new SoftLayer_Dns_Domain_ResourceRecord_SrvType object. The serial number of the domain associated with this SRV record is updated upon deletion.
549 //
550 // ”deleteObject” returns Boolean ”true” on successful deletion or ”false” if it was unable to remove a resource record.
551 func (r Dns_Domain_ResourceRecord_SrvType) DeleteObject() (resp bool, err error) {
552 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "deleteObject", nil, &r.Options, &resp)
553 return
554 }
555 556 // Remove multiple SRV records from a domain. This follows the same logic as ”deleteObject” and ”'cannot be undone”'. The serial number of the domain associated with this SRV record is updated upon deletion.
557 //
558 // ”deleteObjects” returns Boolean ”true” on successful deletion or ”false” if it was unable to remove a resource record.
559 func (r Dns_Domain_ResourceRecord_SrvType) DeleteObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord_SrvType) (resp bool, err error) {
560 params := []interface{}{
561 templateObjects,
562 }
563 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "deleteObjects", params, &r.Options, &resp)
564 return
565 }
566 567 // editObject edits an existing SRV resource record. The ”host” property of the templateObject parameter is scrubbed to remove all non-alpha numeric characters except for "@", "_", ".", "*", and "-". The ”data” property of the templateObject parameter is scrubbed to remove all non-alphanumeric characters for "." and "-". Editing an SRV record updates the serial number of the domain the record is associated with.
568 //
569 // ”editObject” returns Boolean ”true” on a successful edit or ”false” if it was unable to edit the resource record.
570 func (r Dns_Domain_ResourceRecord_SrvType) EditObject(templateObject *datatypes.Dns_Domain_ResourceRecord_SrvType) (resp bool, err error) {
571 params := []interface{}{
572 templateObject,
573 }
574 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "editObject", params, &r.Options, &resp)
575 return
576 }
577 578 // Edit multiple SRV records on a domain. This follows the same logic as ”createObject'. The serial number of the domain associated with this SRV record is updated upon creation.
579 //
580 // ”createObjects” returns Boolean ”true” on successful creation or ”false” if it was unable to create a resource record.
581 func (r Dns_Domain_ResourceRecord_SrvType) EditObjects(templateObjects []datatypes.Dns_Domain_ResourceRecord_SrvType) (resp bool, err error) {
582 params := []interface{}{
583 templateObjects,
584 }
585 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "editObjects", params, &r.Options, &resp)
586 return
587 }
588 589 // Retrieve The domain that a resource record belongs to.
590 func (r Dns_Domain_ResourceRecord_SrvType) GetDomain() (resp datatypes.Dns_Domain, err error) {
591 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "getDomain", nil, &r.Options, &resp)
592 return
593 }
594 595 // getObject retrieves the SoftLayer_Dns_Domain_ResourceRecord_SrvType object whose ID number corresponds to the ID number of the init parameter passed to the SoftLayer_Dns_Domain_ResourceRecord_SrvType service. You can only retrieve resource records belonging to domains that are assigned to your SoftLayer account.
596 func (r Dns_Domain_ResourceRecord_SrvType) GetObject() (resp datatypes.Dns_Domain_ResourceRecord_SrvType, err error) {
597 err = r.Session.DoRequest("SoftLayer_Dns_Domain_ResourceRecord_SrvType", "getObject", nil, &r.Options, &resp)
598 return
599 }
600 601 // The SoftLayer_Dns_Secondary data type contains information on a single secondary DNS zone which is managed through SoftLayer's zone transfer service. Domains created via zone transfer may not be modified by the SoftLayer portal or API.
602 type Dns_Secondary struct {
603 Session session.SLSession
604 Options sl.Options
605 }
606 607 // GetDnsSecondaryService returns an instance of the Dns_Secondary SoftLayer service
608 func GetDnsSecondaryService(sess session.SLSession) Dns_Secondary {
609 return Dns_Secondary{Session: sess}
610 }
611 612 func (r Dns_Secondary) Id(id int) Dns_Secondary {
613 r.Options.Id = &id
614 return r
615 }
616 617 func (r Dns_Secondary) Mask(mask string) Dns_Secondary {
618 if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
619 mask = fmt.Sprintf("mask[%s]", mask)
620 }
621 622 r.Options.Mask = mask
623 return r
624 }
625 626 func (r Dns_Secondary) Filter(filter string) Dns_Secondary {
627 r.Options.Filter = filter
628 return r
629 }
630 631 func (r Dns_Secondary) Limit(limit int) Dns_Secondary {
632 r.Options.Limit = &limit
633 return r
634 }
635 636 func (r Dns_Secondary) Offset(offset int) Dns_Secondary {
637 r.Options.Offset = &offset
638 return r
639 }
640 641 // A secondary DNS record may be converted to a primary DNS record. By converting a secondary DNS record, the SoftLayer name servers will be the authoritative nameserver for this domain and will be directly editable in the SoftLayer API and Portal.
642 //
643 // Primary DNS record conversion performs the following steps:
644 // * The SOA record is updated with SoftLayer's primary name server.
645 // * All NS records are removed and replaced with SoftLayer's NS records.
646 // * The secondary DNS record is removed.
647 //
648 // After the DNS records are converted, the following restrictions will apply to the new domain record:
649 // * You will need to manage the zone record using the [[SoftLayer_Dns_Domain]] service.
650 // * You may not edit the SOA or NS records.
651 // * You may only edit the following resource records: A, AAAA, CNAME, MX, TX, SRV.
652 //
653 // This change can not be undone, and the record can not be converted back into a secondary DNS record once the conversion is complete.
654 func (r Dns_Secondary) ConvertToPrimary() (resp bool, err error) {
655 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "convertToPrimary", nil, &r.Options, &resp)
656 return
657 }
658 659 // Create a secondary DNS record. The ”zoneName”, ”masterIpAddress”, and ”transferFrequency” properties in the templateObject parameter are required parameters to create a secondary DNS record.
660 func (r Dns_Secondary) CreateObject(templateObject *datatypes.Dns_Secondary) (resp datatypes.Dns_Secondary, err error) {
661 params := []interface{}{
662 templateObject,
663 }
664 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "createObject", params, &r.Options, &resp)
665 return
666 }
667 668 // Create multiple secondary DNS records. Each record passed to ”createObjects” follows the logic in the SoftLayer_Dns_Secondary [[SoftLayer_Dns_Secondary::createObject|createObject]] method.
669 func (r Dns_Secondary) CreateObjects(templateObjects []datatypes.Dns_Secondary) (resp []datatypes.Dns_Secondary, err error) {
670 params := []interface{}{
671 templateObjects,
672 }
673 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "createObjects", params, &r.Options, &resp)
674 return
675 }
676 677 // Delete a secondary DNS Record. This will also remove any associated domain records and resource records on the SoftLayer nameservers that were created as a result of the zone transfers. This action cannot be undone.
678 func (r Dns_Secondary) DeleteObject() (resp bool, err error) {
679 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "deleteObject", nil, &r.Options, &resp)
680 return
681 }
682 683 // Edit the properties of a secondary DNS record by passing in a modified instance of a SoftLayer_Dns_Secondary object. You may only edit the ”masterIpAddress” and ”transferFrequency” properties of your secondary DNS record. ”ZoneName” may not be altered after a secondary DNS record has been created. Please remove and re-create the record if you need to make changes to your zone name.
684 func (r Dns_Secondary) EditObject(templateObject *datatypes.Dns_Secondary) (resp bool, err error) {
685 params := []interface{}{
686 templateObject,
687 }
688 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "editObject", params, &r.Options, &resp)
689 return
690 }
691 692 // Retrieve The SoftLayer account that owns a secondary DNS record.
693 func (r Dns_Secondary) GetAccount() (resp datatypes.Account, err error) {
694 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "getAccount", nil, &r.Options, &resp)
695 return
696 }
697 698 // Search for [[SoftLayer_Dns_Secondary]] records by domain name. getByDomainName() performs an inclusive search for secondary domain records, returning multiple records based on partial name matches. Use this method to locate secondary domain records if you don't have access to their id numbers.
699 func (r Dns_Secondary) GetByDomainName(name *string) (resp []datatypes.Dns_Secondary, err error) {
700 params := []interface{}{
701 name,
702 }
703 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "getByDomainName", params, &r.Options, &resp)
704 return
705 }
706 707 // Retrieve The domain record created by zone transfer from a secondary DNS record.
708 func (r Dns_Secondary) GetDomain() (resp datatypes.Dns_Domain, err error) {
709 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "getDomain", nil, &r.Options, &resp)
710 return
711 }
712 713 // Retrieve The error messages created during secondary DNS record transfer.
714 func (r Dns_Secondary) GetErrorMessages() (resp []datatypes.Dns_Message, err error) {
715 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "getErrorMessages", nil, &r.Options, &resp)
716 return
717 }
718 719 // getObject retrieves the SoftLayer_Dns_Secondary object whose ID number corresponds to the ID number of the init paramater passed to the SoftLayer_Dns_Secondary service. You can only retrieve a secondary DNS record that is assigned to your SoftLayer customer account.
720 func (r Dns_Secondary) GetObject() (resp datatypes.Dns_Secondary, err error) {
721 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "getObject", nil, &r.Options, &resp)
722 return
723 }
724 725 // Retrieve The current status of the secondary DNS zone.
726 func (r Dns_Secondary) GetStatus() (resp datatypes.Dns_Status, err error) {
727 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "getStatus", nil, &r.Options, &resp)
728 return
729 }
730 731 // Force a secondary DNS zone transfer by setting it's status "Transfer Now". A zone transfer will be initiated within a minute of receiving this API call.
732 func (r Dns_Secondary) TransferNow() (resp bool, err error) {
733 err = r.Session.DoRequest("SoftLayer_Dns_Secondary", "transferNow", nil, &r.Options, &resp)
734 return
735 }
736