utility.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/session"
  21  	"github.com/softlayer/softlayer-go/sl"
  22  )
  23  
  24  // no documentation yet
  25  type Utility_Network struct {
  26  	Session session.SLSession
  27  	Options sl.Options
  28  }
  29  
  30  // GetUtilityNetworkService returns an instance of the Utility_Network SoftLayer service
  31  func GetUtilityNetworkService(sess session.SLSession) Utility_Network {
  32  	return Utility_Network{Session: sess}
  33  }
  34  
  35  func (r Utility_Network) Id(id int) Utility_Network {
  36  	r.Options.Id = &id
  37  	return r
  38  }
  39  
  40  func (r Utility_Network) Mask(mask string) Utility_Network {
  41  	if !strings.HasPrefix(mask, "mask[") && (strings.Contains(mask, "[") || strings.Contains(mask, ",")) {
  42  		mask = fmt.Sprintf("mask[%s]", mask)
  43  	}
  44  
  45  	r.Options.Mask = mask
  46  	return r
  47  }
  48  
  49  func (r Utility_Network) Filter(filter string) Utility_Network {
  50  	r.Options.Filter = filter
  51  	return r
  52  }
  53  
  54  func (r Utility_Network) Limit(limit int) Utility_Network {
  55  	r.Options.Limit = &limit
  56  	return r
  57  }
  58  
  59  func (r Utility_Network) Offset(offset int) Utility_Network {
  60  	r.Options.Offset = &offset
  61  	return r
  62  }
  63  
  64  // A method used to return the nameserver information for a given address
  65  func (r Utility_Network) NsLookup(address *string, typ *string) (resp string, err error) {
  66  	params := []interface{}{
  67  		address,
  68  		typ,
  69  	}
  70  	err = r.Session.DoRequest("SoftLayer_Utility_Network", "nsLookup", params, &r.Options, &resp)
  71  	return
  72  }
  73  
  74  // Perform a WHOIS lookup from SoftLayer's application servers on the given IP address or hostname and return the raw results of that command. The returned result is similar to the result received from running the command `whois` from a UNIX command shell. A WHOIS lookup queries a host's registrar to retrieve domain registrant information including registration date, expiry date, and the administrative, technical, billing, and abuse contacts responsible for a domain. WHOIS lookups are useful for determining a physical contact responsible for a particular domain. WHOIS lookups are also useful for determining domain availability. Running a WHOIS lookup on an IP address queries ARIN for that IP block's ownership, and is helpful for determining a physical entity responsible for a certain IP address.
  75  func (r Utility_Network) Whois(address *string) (resp string, err error) {
  76  	params := []interface{}{
  77  		address,
  78  	}
  79  	err = r.Session.DoRequest("SoftLayer_Utility_Network", "whois", params, &r.Options, &resp)
  80  	return
  81  }
  82