Qore ServiceNowRestClient Module Reference 1.2
Loading...
Searching...
No Matches
ServiceNowRestClient::ServiceNowRestConnection Class Reference

Class for ServiceNow REST connections; returns ServiceNowRestClient objects. More...

Public Member Functions

 constructor (hash< auto > config, *hash< auto > attr)
 creates the ServiceNowRestConnection object
 
 constructor (string name, string description, string url, hash< auto > attributes={}, hash< auto > options={})
 creates the ServiceNowRestConnection object
 
*string getAppName ()
 Returns the data provider application name this connection serves, if any.
 
DataProvider::AbstractDataProvider getDataProvider (*hash< auto > constructor_options)
 returns a data provider object for this connection
 
string getOAuth2OptionName (string opt)
 Returns the OAuth2 option name for this connection.
 
hash< auto > getOAuth2Options ()
 Returns OAuth2 options in a standard format.
 
string getType ()
 returns "snrests"
 
bool hasDataProvider ()
 returns True as this connection returns a data provider with the getDataProvider() method
 
Qore::AbstractPollOperation startPollConnect (*Logger::LoggerInterface logger)
 Called to start a non-blocking polling ping operation on the ServiceNow REST server.
 

Public Attributes

const ConnectionScheme = ...
 Connection entry info.
 
const DefaultServiceNowPingHeaders = ...
 Default ServiceNow ping headers.
 
const DefaultServiceNowPingMethod = "GET"
 Default ServiceNow ping method.
 
const DefaultServiceNowPingPath = ...
 Default ServiceNow ping path (from the API root)
 
const OAuth2AuthRequestOptions = ...
 options required to support the OAuth2 authorization code grant flow
 
const OAuth2DifferentOptionMap = map {$1.value: $1.key}
 Different OAuth2 option map; standard name => extern name.
 
const OAuth2Options = ...
 Maps ServiceNow REST options to standard options.
 
const OAuth2StandardToServiceNowOptionMap = map {$1.value: $1.key}
 Maps standard option names to ServiceNow REST option names.
 

Protected Member Functions

 checkAuthCodeFeature ()
 Sets the auth code feature if supported.
 
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl ()
 Returns the ConnectionSchemeInfo hash for this object.
 
ServiceNowRestClient getImpl (bool connect=True, *hash< auto > rtopts)
 returns a ServiceNowRestClient object
 
 setChildCapabilities ()
 Sets child data provider capabilities.
 

Detailed Description

Class for ServiceNow REST connections; returns ServiceNowRestClient objects.

In addition to all options supported by RestClientConnection, this connection class supports the following options:

  • "api": the API version for ServiceNow
  • "oauth2_client_id": (optional) the ServiceNow OAuth2 client ID (mapped to the oauth2_client_id option)
  • "oauth2_client_secret": (optional) the ServiceNow OAuth2 client secret (mapped to the oauth2_client_secret option)
See also
ServiceNowRestClient::ServiceNowRestClient::constructor() for more information on the above options

Member Function Documentation

◆ constructor() [1/2]

ServiceNowRestClient::ServiceNowRestConnection::constructor ( hash< auto > config,
*hash< auto > attr )

creates the ServiceNowRestConnection object

Parameters
configwith the following keys:
  • name (required string): the connection name
  • display_name (optional string): the display name
  • short_desc (optional string): a short description in plain text
  • desc (optional string): a long description with markdown formatting
  • url (required string): the connection URL
  • opts (optional hash): connection options
  • logger (optional LoggerInterface object): logger for the connection
attroptional connection attributes
  • monitor (optional bool): should the connection be monitored? Default: True
  • enabled (optional bool): is the connection enabled? Default: True
  • locked (optional bool): is the connection locked? Default: False
  • debug_data (optional bool): debug data? Default: False
  • tags (optional hash): tags for the connection; no default value
Exceptions
CONNECTION-OPTION-ERRORmissing or invalid connection option or attribute

◆ constructor() [2/2]

ServiceNowRestClient::ServiceNowRestConnection::constructor ( string name,
string description,
string url,
hash< auto > attributes = {},
hash< auto > options = {} )

creates the ServiceNowRestConnection object

Parameters
namethe name of the connection
descriptionconnection description
urlconnection URL (potentially with password info)
attributesvarious attributes. See below
optionsconnection options

See ConnectionProvider::AbstractConnection::constructor() for attributes and options reference.

Exceptions
CONNECTION-OPTION-ERRORmissing or invalid connection option

◆ getAppName()

*string ServiceNowRestClient::ServiceNowRestConnection::getAppName ( )

Returns the data provider application name this connection serves, if any.

Returns
the data provider application name this connection serves, if any

◆ getDataProvider()

DataProvider::AbstractDataProvider ServiceNowRestClient::ServiceNowRestConnection::getDataProvider ( *hash< auto > constructor_options)

returns a data provider object for this connection

Parameters
constructor_optionsany additional constructor options for the data provider
Returns
a data provider object for this connection

◆ getImpl()

ServiceNowRestClient ServiceNowRestClient::ServiceNowRestConnection::getImpl ( bool connect = True,
*hash< auto > rtopts )
protected

returns a ServiceNowRestClient object

Parameters
connectif True, then the connection is returned already connected
rtoptsthis connection type does not accept any runtime options, so this parameter is ignored
Returns
a ServiceNowRestClient object

◆ getOAuth2OptionName()

string ServiceNowRestClient::ServiceNowRestConnection::getOAuth2OptionName ( string opt)

Returns the OAuth2 option name for this connection.

Since
ServiceNowRestClient 2.0

◆ getOAuth2Options()

hash< auto > ServiceNowRestClient::ServiceNowRestConnection::getOAuth2Options ( )

Returns OAuth2 options in a standard format.

Since
ServiceNowRestClient 2.0

◆ hasDataProvider()

bool ServiceNowRestClient::ServiceNowRestConnection::hasDataProvider ( )

returns True as this connection returns a data provider with the getDataProvider() method

Returns
True as this connection returns a data provider with the getDataProvider() method
See also
getDataProvider()

◆ startPollConnect()

Qore::AbstractPollOperation ServiceNowRestClient::ServiceNowRestConnection::startPollConnect ( *Logger::LoggerInterface logger)

Called to start a non-blocking polling ping operation on the ServiceNow REST server.

Returns
a socket poll operation object that will allow the connection goal to be reached with polling
See also
supportsPollingApi()