github.com/infobloxopen/infoblox-go-client@v1.1.1/objects.go (about)

     1  package ibclient
     2  
     3  import (
     4  	"bytes"
     5  	"encoding/json"
     6  	"fmt"
     7  	"reflect"
     8  )
     9  
    10  const MACADDR_ZERO = "00:00:00:00:00:00"
    11  
    12  type Bool bool
    13  
    14  type EA map[string]interface{}
    15  
    16  type EASearch map[string]interface{}
    17  
    18  type EADefListValue string
    19  
    20  type IBBase struct {
    21  	objectType   string
    22  	returnFields []string
    23  	eaSearch     EASearch
    24  }
    25  
    26  type IBObject interface {
    27  	ObjectType() string
    28  	ReturnFields() []string
    29  	EaSearch() EASearch
    30  	//SetReturnFields([]string)
    31  }
    32  
    33  func (obj *IBBase) ObjectType() string {
    34  	return obj.objectType
    35  }
    36  
    37  func (obj *IBBase) ReturnFields() []string {
    38  	return obj.returnFields
    39  }
    40  
    41  func (obj *IBBase) EaSearch() EASearch {
    42  	return obj.eaSearch
    43  }
    44  
    45  type NetworkView struct {
    46  	IBBase `json:"-"`
    47  	Ref    string `json:"_ref,omitempty"`
    48  	Name   string `json:"name,omitempty"`
    49  	Ea     EA     `json:"extattrs,omitempty"`
    50  }
    51  
    52  func NewNetworkView(nv NetworkView) *NetworkView {
    53  	res := nv
    54  	res.objectType = "networkview"
    55  	res.returnFields = []string{"extattrs", "name"}
    56  
    57  	return &res
    58  }
    59  
    60  // UpgradeStatus object representation
    61  type UpgradeStatus struct {
    62  	IBBase           `json:"-"`
    63  	Ref              string              `json:"_ref,omitempty"`
    64  	Type             string              `json:"type"`
    65  	SubElementStatus []SubElementsStatus `json:"subelements_status,omitempty"`
    66  	UpgradeGroup     string              `json:"upgrade_group,omitempty"`
    67  }
    68  
    69  func NewUpgradeStatus(upgradeStatus UpgradeStatus) *UpgradeStatus {
    70  	result := upgradeStatus
    71  	returnFields := []string{"subelements_status", "type"}
    72  	result.objectType = "upgradestatus"
    73  	result.returnFields = returnFields
    74  	return &result
    75  }
    76  
    77  // SubElementsStatus object representation
    78  type SubElementsStatus struct {
    79  	Ref            string `json:"_ref,omitempty"`
    80  	CurrentVersion string `json:"current_version"`
    81  	ElementStatus  string `json:"element_status"`
    82  	Ipv4Address    string `json:"ipv4_address"`
    83  	Ipv6Address    string `json:"ipv6_address"`
    84  	StatusValue    string `json:"status_value"`
    85  	StepsTotal     int    `json:"steps_total"`
    86  	StepsCompleted int    `json:"steps_completed"`
    87  	NodeType       string `json:"type"`
    88  	Member         string `json:"member"`
    89  }
    90  
    91  type Network struct {
    92  	IBBase
    93  	Ref         string `json:"_ref,omitempty"`
    94  	NetviewName string `json:"network_view,omitempty"`
    95  	Cidr        string `json:"network,omitempty"`
    96  	Ea          EA     `json:"extattrs,omitempty"`
    97  }
    98  
    99  func NewNetwork(nw Network) *Network {
   100  	res := nw
   101  	res.objectType = "network"
   102  	res.returnFields = []string{"extattrs", "network", "network_view"}
   103  
   104  	return &res
   105  }
   106  
   107  type ServiceStatus struct {
   108  	Desciption string `json:"description,omitempty"`
   109  	Service    string `json:"service,omitempty"`
   110  	Status     string `json:"status,omitempty"`
   111  }
   112  
   113  type LanHaPortSetting struct {
   114  	HAIpAddress    string              `json:"ha_ip_address,omitempty"`
   115  	HaPortSetting  PhysicalPortSetting `json:"ha_port_setting,omitempty"`
   116  	LanPortSetting PhysicalPortSetting `json:"lan_port_setting,omitempty"`
   117  	MgmtIpv6addr   string              `json:"mgmt_ipv6addr,omitempty"`
   118  	MgmtLan        string              `json:"mgmt_lan,omitempty"`
   119  }
   120  
   121  type PhysicalPortSetting struct {
   122  	AutoPortSettingEnabled bool   `json:"auto_port_setting_enabled"`
   123  	Duplex                 string `json:"duplex,omitempty"`
   124  	Speed                  string `json:"speed,omitempty"`
   125  }
   126  
   127  type NetworkSetting struct {
   128  	Address    string `json:"address"`
   129  	Dscp       uint   `json:"dscp"`
   130  	Gateway    string `json:"gateway"`
   131  	Primary    bool   `json:"primary"`
   132  	SubnetMask string `json:"subnet_mask"`
   133  	UseDscp    bool   `json:"use_dscp,omiempty"`
   134  	VlanId     uint   `json:"vlan_id,omitempty"`
   135  }
   136  type Ipv6Setting struct {
   137  	AutoRouterConfigEnabled bool   `json:"auto_router_config_enabled"`
   138  	CidrPrefix              uint   `json:"cidr_prefix,omitempty"`
   139  	Dscp                    uint   `json:"dscp,omitempty"`
   140  	Enabled                 bool   `json:"enabled,omitempty"`
   141  	Gateway                 string `json:"gateway"`
   142  	Primary                 string `json:"primary,omitempty"`
   143  	VirtualIp               string `json:"virtual_ip"`
   144  	VlanId                  uint   `json:"vlan_id,emitempty"`
   145  	UseDscp                 bool   `json:"use_dscp,omitempty"`
   146  }
   147  
   148  type NodeInfo struct {
   149  	HaStatus             string              `json:"ha_status,omitempty"`
   150  	HwId                 string              `json:"hwid,omitempty"`
   151  	HwModel              string              `json:"hwmodel,omitempty"`
   152  	HwPlatform           string              `json:"hwplatform,omitempty"`
   153  	HwType               string              `json:"hwtype,omitempty"`
   154  	Lan2PhysicalSetting  PhysicalPortSetting `json:"lan2_physical_setting,omitempty"`
   155  	LanHaPortSetting     LanHaPortSetting    `json:"lan_ha_Port_Setting,omitempty"`
   156  	MgmtNetworkSetting   NetworkSetting      `json:"mgmt_network_setting,omitempty"`
   157  	MgmtPhysicalSetting  PhysicalPortSetting `json:"mgmt_physical_setting,omitempty"`
   158  	PaidNios             bool                `json:"paid_nios,omitempty"`
   159  	PhysicalOid          string              `json:"physical_oid,omitempty"`
   160  	ServiceStatus        []ServiceStatus     `json:"service_status,omitempty"`
   161  	V6MgmtNetworkSetting Ipv6Setting         `json:"v6_mgmt_network_setting,omitempty"`
   162  }
   163  
   164  // Member represents NIOS member
   165  type Member struct {
   166  	IBBase                   `json:"-"`
   167  	Ref                      string     `json:"_ref,omitempty"`
   168  	HostName                 string     `json:"host_name,omitempty"`
   169  	ConfigAddrType           string     `json:"config_addr_type,omitempty"`
   170  	PLATFORM                 string     `json:"platform,omitempty"`
   171  	ServiceTypeConfiguration string     `json:"service_type_configuration,omitempty"`
   172  	Nodeinfo                 []NodeInfo `json:"node_info,omitempty"`
   173  	TimeZone                 string     `json:"time_zone,omitempty"`
   174  }
   175  
   176  func NewMember(member Member) *Member {
   177  	res := member
   178  	res.objectType = "member"
   179  	returnFields := []string{"host_name", "node_info", "time_zone"}
   180  	res.returnFields = returnFields
   181  	return &res
   182  }
   183  
   184  // License represents license wapi object
   185  type License struct {
   186  	IBBase           `json:"-"`
   187  	Ref              string `json:"_ref,omitempty"`
   188  	ExpirationStatus string `json:"expiration_status,omitempty"`
   189  	ExpiryDate       int    `json:"expiry_date,omitempty"`
   190  	HwID             string `json:"hwid,omitempty"`
   191  	Key              string `json:"key,omitempty"`
   192  	Kind             string `json:"kind,omitempty"`
   193  	Limit            string `json:"limit,omitempty"`
   194  	LimitContext     string `json:"limit_context,omitempty"`
   195  	Licensetype      string `json:"type,omitempty"`
   196  }
   197  
   198  func NewGridLicense(license License) *License {
   199  	result := license
   200  	result.objectType = "license:gridwide"
   201  	returnFields := []string{"expiration_status",
   202  		"expiry_date",
   203  		"key",
   204  		"limit",
   205  		"limit_context",
   206  		"type"}
   207  	result.returnFields = returnFields
   208  	return &result
   209  }
   210  
   211  func NewLicense(license License) *License {
   212  	result := license
   213  	returnFields := []string{"expiration_status",
   214  		"expiry_date",
   215  		"hwid",
   216  		"key",
   217  		"kind",
   218  		"limit",
   219  		"limit_context",
   220  		"type"}
   221  	result.objectType = "member:license"
   222  	result.returnFields = returnFields
   223  	return &result
   224  }
   225  
   226  // CapacityReport represents capacityreport object
   227  type CapacityReport struct {
   228  	IBBase `json:"-"`
   229  	Ref    string `json:"_ref,omitempty"`
   230  
   231  	Name         string                   `json:"name,omitempty"`
   232  	HardwareType string                   `json:"hardware_type,omitempty"`
   233  	MaxCapacity  int                      `json:"max_capacity,omitempty"`
   234  	ObjectCount  []map[string]interface{} `json:"object_counts,omitempty"`
   235  	PercentUsed  int                      `json:"percent_used,omitempty"`
   236  	Role         string                   `json:"role,omitempty"`
   237  	TotalObjects int                      `json:"total_objects,omitempty"`
   238  }
   239  
   240  func NewCapcityReport(capReport CapacityReport) *CapacityReport {
   241  	res := capReport
   242  	returnFields := []string{"name", "hardware_type", "max_capacity", "object_counts", "percent_used", "role", "total_objects"}
   243  	res.objectType = "capacityreport"
   244  	res.returnFields = returnFields
   245  	return &res
   246  }
   247  
   248  type NTPserver struct {
   249  	Address              string `json:"address,omitempty"`
   250  	Burst                bool   `json:"burst,omitempty"`
   251  	EnableAuthentication bool   `json:"enable_authentication,omitempty"`
   252  	IBurst               bool   `json:"iburst,omitempty"`
   253  	NTPKeyNumber         uint   `json:"ntp_key_number,omitempty"`
   254  	Preffered            bool   `json:"preffered,omitempty"`
   255  }
   256  
   257  type NTPSetting struct {
   258  	EnableNTP  bool                   `json:"enable_ntp,omitempty"`
   259  	NTPAcl     map[string]interface{} `json:"ntp_acl,omitempty"`
   260  	NTPKeys    []string               `json:"ntp_keys,omitempty"`
   261  	NTPKod     bool                   `json:"ntp_kod,omitempty"`
   262  	NTPServers []NTPserver            `json:"ntp_servers,omitempty"`
   263  }
   264  
   265  type Grid struct {
   266  	IBBase     `json:"-"`
   267  	Ref        string      `json:"_ref,omitempty"`
   268  	Name       string      `json:"name,omitempty"`
   269  	NTPSetting *NTPSetting `json:"ntp_setting,omitempty"`
   270  }
   271  
   272  func NewGrid(grid Grid) *Grid {
   273  	result := grid
   274  	result.objectType = "grid"
   275  	returnFields := []string{"name", "ntp_setting"}
   276  	result.returnFields = returnFields
   277  	return &result
   278  }
   279  
   280  type NetworkContainer struct {
   281  	IBBase      `json:"-"`
   282  	Ref         string `json:"_ref,omitempty"`
   283  	NetviewName string `json:"network_view,omitempty"`
   284  	Cidr        string `json:"network,omitempty"`
   285  	Ea          EA     `json:"extattrs,omitempty"`
   286  }
   287  
   288  func NewNetworkContainer(nc NetworkContainer) *NetworkContainer {
   289  	res := nc
   290  	res.objectType = "networkcontainer"
   291  	res.returnFields = []string{"extattrs", "network", "network_view"}
   292  
   293  	return &res
   294  }
   295  
   296  type FixedAddress struct {
   297  	IBBase      `json:"-"`
   298  	Ref         string `json:"_ref,omitempty"`
   299  	NetviewName string `json:"network_view,omitempty"`
   300  	Cidr        string `json:"network,omitempty"`
   301  	IPAddress   string `json:"ipv4addr,omitempty"`
   302  	Mac         string `json:"mac,omitempty"`
   303  	Name        string `json:"name,omitempty"`
   304  	MatchClient string `json:"match_client,omitempty"`
   305  	Ea          EA     `json:"extattrs,omitempty"`
   306  }
   307  
   308  /*This is a general struct to add query params used in makeRequest*/
   309  type QueryParams struct {
   310  	forceProxy bool
   311  }
   312  
   313  func NewFixedAddress(fixedAddr FixedAddress) *FixedAddress {
   314  	res := fixedAddr
   315  	res.objectType = "fixedaddress"
   316  	res.returnFields = []string{"extattrs", "ipv4addr", "mac", "name", "network", "network_view"}
   317  
   318  	return &res
   319  }
   320  
   321  type EADefinition struct {
   322  	IBBase             `json:"-"`
   323  	Ref                string           `json:"_ref,omitempty"`
   324  	Comment            string           `json:"comment,omitempty"`
   325  	Flags              string           `json:"flags,omitempty"`
   326  	ListValues         []EADefListValue `json:"list_values,omitempty"`
   327  	Name               string           `json:"name,omitempty"`
   328  	Type               string           `json:"type,omitempty"`
   329  	AllowedObjectTypes []string         `json:"allowed_object_types,omitempty"`
   330  }
   331  
   332  func NewEADefinition(eadef EADefinition) *EADefinition {
   333  	res := eadef
   334  	res.objectType = "extensibleattributedef"
   335  	res.returnFields = []string{"allowed_object_types", "comment", "flags", "list_values", "name", "type"}
   336  
   337  	return &res
   338  }
   339  
   340  type UserProfile struct {
   341  	IBBase `json:"-"`
   342  	Ref    string `json:"_ref,omitempty"`
   343  	Name   string `json:"name,omitempty"`
   344  }
   345  
   346  func NewUserProfile(userprofile UserProfile) *UserProfile {
   347  	res := userprofile
   348  	res.objectType = "userprofile"
   349  	res.returnFields = []string{"name"}
   350  
   351  	return &res
   352  }
   353  
   354  type RecordA struct {
   355  	IBBase   `json:"-"`
   356  	Ref      string `json:"_ref,omitempty"`
   357  	Ipv4Addr string `json:"ipv4addr,omitempty"`
   358  	Name     string `json:"name,omitempty"`
   359  	View     string `json:"view,omitempty"`
   360  	Zone     string `json:"zone,omitempty"`
   361  	Ea       EA     `json:"extattrs,omitempty"`
   362  }
   363  
   364  func NewRecordA(ra RecordA) *RecordA {
   365  	res := ra
   366  	res.objectType = "record:a"
   367  	res.returnFields = []string{"extattrs", "ipv4addr", "name", "view", "zone"}
   368  
   369  	return &res
   370  }
   371  
   372  type RecordPTR struct {
   373  	IBBase   `json:"-"`
   374  	Ref      string `json:"_ref,omitempty"`
   375  	Ipv4Addr string `json:"ipv4addr,omitempty"`
   376  	Name     string `json:"name,omitempty"`
   377  	PtrdName string `json:"ptrdname,omitempty"`
   378  	View     string `json:"view,omitempty"`
   379  	Zone     string `json:"zone,omitempty"`
   380  	Ea       EA     `json:"extattrs,omitempty"`
   381  }
   382  
   383  func NewRecordPTR(rptr RecordPTR) *RecordPTR {
   384  	res := rptr
   385  	res.objectType = "record:ptr"
   386  	res.returnFields = []string{"extattrs", "ipv4addr", "ptrdname", "view", "zone"}
   387  
   388  	return &res
   389  }
   390  
   391  type RecordCNAME struct {
   392  	IBBase    `json:"-"`
   393  	Ref       string `json:"_ref,omitempty"`
   394  	Canonical string `json:"canonical,omitempty"`
   395  	Name      string `json:"name,omitempty"`
   396  	View      string `json:"view,omitempty"`
   397  	Zone      string `json:"zone,omitempty"`
   398  	Ea        EA     `json:"extattrs,omitempty"`
   399  	Ttl       uint   `json:"ttl,omitempty"`
   400  	UseTtl    bool   `json:"use_ttl,omitempty"`
   401  }
   402  
   403  func NewRecordCNAME(rc RecordCNAME) *RecordCNAME {
   404  	res := rc
   405  	res.objectType = "record:cname"
   406  	res.returnFields = []string{"extattrs", "canonical", "name", "view", "zone", "ttl", "use_ttl"}
   407  
   408  	return &res
   409  }
   410  
   411  type HostRecordIpv4Addr struct {
   412  	IBBase   `json:"-"`
   413  	Ipv4Addr string `json:"ipv4addr,omitempty"`
   414  	Ref      string `json:"_ref,omitempty"`
   415  	Mac      string `json:"mac,omitempty"`
   416  	View     string `json:"view,omitempty"`
   417  	Cidr     string `json:"network,omitempty"`
   418  }
   419  
   420  func NewHostRecordIpv4Addr(hostAddr HostRecordIpv4Addr) *HostRecordIpv4Addr {
   421  	res := hostAddr
   422  	res.objectType = "record:host_ipv4addr"
   423  	return &res
   424  }
   425  
   426  type HostRecord struct {
   427  	IBBase      `json:"-"`
   428  	Ref         string               `json:"_ref,omitempty"`
   429  	Ipv4Addr    string               `json:"ipv4addr,omitempty"`
   430  	Ipv4Addrs   []HostRecordIpv4Addr `json:"ipv4addrs,omitempty"`
   431  	Name        string               `json:"name,omitempty"`
   432  	View        string               `json:"view,omitempty"`
   433  	Zone        string               `json:"zone,omitempty"`
   434  	EnableDns   *bool                `json:"configure_for_dns,omitempty"`
   435  	NetworkView string               `json:"network_view,omitempty"`
   436  	Ea          EA                   `json:"extattrs,omitempty"`
   437  }
   438  
   439  func NewHostRecord(rh HostRecord) *HostRecord {
   440  	res := rh
   441  	res.objectType = "record:host"
   442  	res.returnFields = []string{"extattrs", "ipv4addrs", "name", "view", "zone"}
   443  
   444  	return &res
   445  }
   446  
   447  type RecordTXT struct {
   448  	IBBase `json:"-"`
   449  	Ref    string `json:"_ref,omitempty"`
   450  	Name   string `json:"name,omitempty"`
   451  	Text   string `json:"text,omitempty"`
   452  	Ttl    uint   `json:"ttl,omitempty"`
   453  	View   string `json:"view,omitempty"`
   454  	Zone   string `json:"zone,omitempty"`
   455  	Ea     EA     `json:"extattrs,omitempty"`
   456  	UseTtl bool   `json:"use_ttl,omitempty"`
   457  }
   458  
   459  func NewRecordTXT(rt RecordTXT) *RecordTXT {
   460  	res := rt
   461  	res.objectType = "record:txt"
   462  	res.returnFields = []string{"extattrs", "name", "text", "view", "zone", "ttl", "use_ttl"}
   463  
   464  	return &res
   465  }
   466  
   467  type ZoneAuth struct {
   468  	IBBase `json:"-"`
   469  	Ref    string `json:"_ref,omitempty"`
   470  	Fqdn   string `json:"fqdn,omitempty"`
   471  	View   string `json:"view,omitempty"`
   472  	Ea     EA     `json:"extattrs,omitempty"`
   473  }
   474  
   475  func NewZoneAuth(za ZoneAuth) *ZoneAuth {
   476  	res := za
   477  	res.objectType = "zone_auth"
   478  	res.returnFields = []string{"extattrs", "fqdn", "view"}
   479  
   480  	return &res
   481  }
   482  
   483  type NameServer struct {
   484  	Address string `json:"address,omitempty"`
   485  	Name    string `json:"name,omitempty"`
   486  }
   487  
   488  type ZoneDelegated struct {
   489  	IBBase     `json:"-"`
   490  	Ref        string       `json:"_ref,omitempty"`
   491  	Fqdn       string       `json:"fqdn,omitempty"`
   492  	DelegateTo []NameServer `json:"delegate_to,omitempty"`
   493  	View       string       `json:"view,omitempty"`
   494  	Ea         EA           `json:"extattrs,omitempty"`
   495  }
   496  
   497  func NewZoneDelegated(za ZoneDelegated) *ZoneDelegated {
   498  	res := za
   499  	res.objectType = "zone_delegated"
   500  	res.returnFields = []string{"extattrs", "fqdn", "view", "delegate_to"}
   501  
   502  	return &res
   503  }
   504  
   505  func (ea EA) MarshalJSON() ([]byte, error) {
   506  	m := make(map[string]interface{})
   507  	for k, v := range ea {
   508  		value := make(map[string]interface{})
   509  		value["value"] = v
   510  		m[k] = value
   511  	}
   512  
   513  	return json.Marshal(m)
   514  }
   515  
   516  func (eas EASearch) MarshalJSON() ([]byte, error) {
   517  	m := make(map[string]interface{})
   518  	for k, v := range eas {
   519  		m["*"+k] = v
   520  	}
   521  
   522  	return json.Marshal(m)
   523  }
   524  
   525  func (v EADefListValue) MarshalJSON() ([]byte, error) {
   526  	m := make(map[string]string)
   527  	m["value"] = string(v)
   528  
   529  	return json.Marshal(m)
   530  }
   531  
   532  func (b Bool) MarshalJSON() ([]byte, error) {
   533  	if b {
   534  		return json.Marshal("True")
   535  	}
   536  
   537  	return json.Marshal("False")
   538  }
   539  
   540  func (ea *EA) UnmarshalJSON(b []byte) (err error) {
   541  	var m map[string]map[string]interface{}
   542  
   543  	decoder := json.NewDecoder(bytes.NewBuffer(b))
   544  	decoder.UseNumber()
   545  	err = decoder.Decode(&m)
   546  	if err != nil {
   547  		return
   548  	}
   549  
   550  	*ea = make(EA)
   551  	for k, v := range m {
   552  		val := v["value"]
   553  		switch valType := reflect.TypeOf(val).String(); valType {
   554  		case "json.Number":
   555  			var i64 int64
   556  			i64, err = val.(json.Number).Int64()
   557  			val = int(i64)
   558  		case "string":
   559  			if val.(string) == "True" {
   560  				val = Bool(true)
   561  			} else if val.(string) == "False" {
   562  				val = Bool(false)
   563  			}
   564  		case "[]interface {}":
   565  			nval := val.([]interface{})
   566  			nVals := make([]string, len(nval))
   567  			for i, v := range nval {
   568  				nVals[i] = fmt.Sprintf("%v", v)
   569  			}
   570  			val = nVals
   571  		default:
   572  			val = fmt.Sprintf("%v", val)
   573  		}
   574  
   575  		(*ea)[k] = val
   576  	}
   577  
   578  	return
   579  }
   580  
   581  func (v *EADefListValue) UnmarshalJSON(b []byte) (err error) {
   582  	var m map[string]string
   583  	err = json.Unmarshal(b, &m)
   584  	if err != nil {
   585  		return
   586  	}
   587  
   588  	*v = EADefListValue(m["value"])
   589  	return
   590  }
   591  
   592  type RequestBody struct {
   593  	Data               map[string]interface{} `json:"data,omitempty"`
   594  	Args               map[string]string      `json:"args,omitempty"`
   595  	Method             string                 `json:"method"`
   596  	Object             string                 `json:"object,omitempty"`
   597  	EnableSubstitution bool                   `json:"enable_substitution,omitempty"`
   598  	AssignState        map[string]string      `json:"assign_state,omitempty"`
   599  	Discard            bool                   `json:"discard,omitempty"`
   600  }
   601  
   602  type SingleRequest struct {
   603  	IBBase `json:"-"`
   604  	Body   *RequestBody
   605  }
   606  
   607  type MultiRequest struct {
   608  	IBBase `json:"-"`
   609  	Body   []*RequestBody
   610  }
   611  
   612  func (r *MultiRequest) MarshalJSON() ([]byte, error) {
   613  	return json.Marshal(r.Body)
   614  }
   615  
   616  func NewMultiRequest(body []*RequestBody) *MultiRequest {
   617  	req := &MultiRequest{Body: body}
   618  	req.objectType = "request"
   619  	return req
   620  }
   621  
   622  func NewRequest(body *RequestBody) *SingleRequest {
   623  	req := &SingleRequest{Body: body}
   624  	req.objectType = "request"
   625  	return req
   626  }